Databases Reference
In-Depth Information
Comparing bookmark and query history
features
In Chapter 11 , we learned about the SQL history feature, which automatically stores
queries (temporarily or permanently). There are similarities between queries stored
in the history and bookmarks. After all both features are intended to store queries
for later execution. However, there are important differences regarding the way the
queries are stored and the action that triggers the recording of a query.
Storing of queries in the history is automatic; whereas a query is saved as a
bookmark via an explicit request from the user. Also, there is a configurable limit
(refer to Chapter 11 ) on the number of queries stored in the permanent history;
however, the number of bookmarks is not limited. Finally, the history feature
presents the queries in the reverse order of the time they were sent. However,
bookmarks are shown by label (not showing the query text directly).
To summarize, the automatic query history is useful when we neither plan to recall
a query, nor wish to remember which queries we typed. This contrasts with the
bookmark facility where we intentionally ask the system to remember a query, and
even give it a name (label). Therefore, we can do more with bookmarks than with the
query history, but both features have their own importance.
Creating bookmarks
There are two instances when it is possible to create a bookmark—after a query is
executed (in which case we don't need to plan ahead for its creation), and before
sending the query to the MySQL server for execution. Both of these options are
explored in the following sections.
Creating a bookmark after a successful query
Initial bookmark creation is made possible by the Bookmark this SQL query button.
This button appears only after executing a query that generates a result (when at
least one row is found); so this method for creating bookmarks only stores SELECT
statements. For example, a complex query produced by the multi-table query
generator (as seen in Chapter 12 ) could be stored as a bookmark in this way, provided
that it finds some results.
 
Search WWH ::




Custom Search