How to Use JRS
As soon as the system has started you can use an existing database or
to create a new one. Existing databases are listed in the Metadata Browser window.
Once a database has been selected, you can see the database schema
and the system catalog tables using the browser window.
Once a database schema is created or updated, you must restart the browser application, with Show Database Browser in the File menu, for the new definitions to be visible.
To use a database you may select it from the browser or type the following
statement in the Input Window:
CONNECT DatabaseName;
Note that an SQL statement is terminated by a semicolon.
SQL keywords do not have to be entered in upper-case letters; lower-case
may also be used. Database, tables and attribute names are case sensitive.
You can enter SQL statements in three ways:
- by typing them in the Input Window;
- by copying them from a text file (see options in the Edit menu);
- by loading a file which contains a set of statements terminated by
a semicolon (see options in the File menu);
- definitions in the Input Window can be edited.
The results of SQL statements are displayed in the Output Window. The
content of this window cannot be edited, but it can be selected and copied,
or saved into a file with the command Save from the File menu.
A set of SQL statements for the sample database SportDB is available
in the page SQL By Examples of the Help index.
The following list describe the function of each button of the JRS interface:
- Execute. To execute a statement present in the Input Window you must first select
it and then click on Execute.
- Select All. To select and execute all the statements
present in the Input Window, click on Select All and then on Execute.
- Logical Plan and Physical Plan. They are used to open a Graphical Editor window to define and execute a graphical query plan.
- Quit. To close the JRS applications.
The following list describe the function of each menu at the top of the JRS interface:
- ?. To see tips about the menus and buttons of the interface.
- Catalog. To see the catalog tables with information about the database in use.
- Syntax. To see the syntax of an SQL command.
- Options. To choose one
or more of the following options before executing an SQL statement:
- Query Transformation is used by default to rewrite a query so that a better physical or logical plan can be found. With complex queries is interesting to compare the physical or logical plan generated with or without query transformation. Examples of query transformations are the elimination from the plans of useless DISTINCT, GROUP BY, HAVING, and SORT;
- Query Optimizer with options about Tree Type, Search Strategy and Physical Operator.
By default the system optimize a query using a Left Deep tree type, a Greedy Search strategy and all physical operators.
A more accurate optimization can be selected from the Options menu, but
note that for complex queries the optimization process can be time
consuming! So the suggestion is to start with the default choices and see the effect of excluding some physical operators.
- Print Exec Time to see the physical plan generation time, physical plan execution time and total execution time;
- Add Query to Output Window for a pretty-printed version of the SQL statement;
- Show Physical Plan to execute the query and to see the physical plan.
- Show Physical Plan Only or Show Logical Plan Only to see only the selected type of plan, without query execution.
- File. To choose one of the following options:
to load a file,
to save the contents of the Input or Output windows, to restart the browser application.
Once you have loaded data in a new or predefined database, update statistics used by
the optimizer with the command: UPDATE STATISTICS
Index Page