Introduction to NonStop SQL/MP
What Happens When a Query Is Submitted
NonStop SQL Architecture
113425 Tandem Computers Incorporated 3–9
UPDATE PARTLOC
SET QTY_ON_HAND = QTY_ON_HAND + 20
WHERE LOC_CODE = "A21" AND PARTNUM = 1403 ;
A partitioned table in NonStop SQL/MP is highly available. Only the partitions being
accessed must be available when you retrieve, update, or insert data. Even if network
access became temporarily unavailable, you would still have access to your local
partition. Also, the DBA can add, drop, move, and split partitions while the entire
table remains online and available for querying. (In most cases, these database
configuration operations will make the affected partitions unavailable for only a very
short time.)
What Happens When a
Query Is Submitted?
When you submit an SQL query to NonStop SQL/MP, the database system does three
things:
Determines the most efficient plan for executing the SQL statement
Compiles the statement into an executable object
Executes the plan
The manner in which NonStop SQL/MP performs these functions depends first on
whether the query uses dynamic or static SQL. Ad hoc queries submitted through an
interface such as the NonStop ODBC Server and queries submitted directly through
the conversational interface (SQLCI) are likely to be dynamic. NonStop SQL/MP
prepares these queries for execution, compiles them, and executes them as soon as
they are submitted.
Host-language programs containing embedded SQL statements are likely to use static
SQL. NonStop SQL/MP compiles static SQL statements when the program is
developed, after the language compiler compiles the host-language source code. The
compiled SQL statements are placed into production as part of the host object
program. When a user invokes the application logic that calls a particular SQL
statement, that statement is executed.
Figure 3-4 shows a simple diagram of the main components of NonStop SQL/MP.
When you submit a dynamic SQL statement, the SQL executor invokes the SQL
compiler, which compiles the statement and returns it to the SQL executor. The SQL
executor then manages the retrieval of data from the database tables and returns the
results to the client submitting the query.