Database Reference
In-Depth Information
insert.append("'").append(util.generateName()).append("',");
insert.append("'").append(dateFormat.format(
new Date())).append("');").append("\n");
Files.append(insert.toString(), new File(userFile), charset);
}
Please note that in the internal loop, we generate a random number of emails for
users. The code for all random generation e-mails is collected in the Util class.
To actually use this code, generate the data and prefill the table. Then enter the
following command:
cd generators
./run_generate_users.sh 100 10
Here, the two parameters are number-users and number-emails per user. This
will generate the required number of rows in the generated folder.
Now, run the following command to load the data:
./sqlline.sh localhost $HBASE_BOOK_HOME/generated/users.txt
Analyzing your query
In order to analyze a query, we need to pay attention to performance monitoring for
each query. Phoenix lacks the profiling feature, but there is a lot of work going on in
this direction. Meanwhile, you can analyze the steps needed in order to perform the
query. This is described at http://phoenix.incubator.apache.org/language/
index.html#/explain . By analyzing the steps of a query, we can reason the
performance of that query. In this case, the steps are simple enough to understand
and are left for the reader to work with in the form of an exercise.
Exercise
Insert a username and then insert it again. Watch the overwriting without any
warning. How will you place a new e-mail at the top or bottom of the list?
As an added exercise, please come up with your answers before looking at the
answer provided.
 
Search WWH ::




Custom Search