SQL/MP Programming Manual for COBOL85

HP NonStop SQL/MP Programming Manual for COBOL85429326-004
C-1
C Maximizing Local Autonomy
This appendix describes about the local autonomy in the NonStop SQL/MP
network-distributed database, which ensures that a program can access data on the
local node, regardless of the availability of SQL objects on remote nodes. In some
cases, the design of NonStop SQL/MP allows for local autonomy. For example, if a
DDL change alters a table on \NODEA when \NODEB is unavailable, an SQL program
file on \NODEB that uses the altered \NODEA table is not marked as invalid. The
invalid SQL program on \NODEB that is erroneously marked as valid is detected at run
time by the timestamp check and then automatically recompiled.
If your program accesses a network-distributed database, you can maximize local
autonomy by following these guidelines:
Use a local partition, rather than the primary partition, as the table name for
partitioned tables.
Use TACL DEFINEs to refer to tables.
Use current statistics.
Skip unavailable partitions.
For collations, SQL/MP supports run-time node autonomy because collations are
stored in an SQL object’s file label and within expressions that operate on the SQL
objects. For example, suppose that you create a partitioned table, TABLEA, with
partitions on \NEWYORK and \PARIS. TABLEA requires the collation
\NEWYORK.$SQL.COLLATE.FRENCH. If \NEWYORK goes down, programs on
\PARIS that refer to TABLEA continue to run, because they get the collation
information from the TABLEA file label. However, the recompilation of a program on
\PARIS that uses TABLEA fails, because the \NEWYORK.$SQL.COLLATE.FRENCH
collation is not available.
Using a Local Partition
If your program uses a remote partition, the SQL compiler looks for information about
the table in a remote catalog. If the remote node is down, the SQL compilation fails;
however, if your program uses a local partition, the SQL compiler looks for the
information in a local catalog. If the local node and the data is available, the SQL
compilation is successful.
This example shows the concept of maximizing local autonomy. The PARTS table is a
partitioned table that resides on the \NEWYORK and \PARIS nodes:
\NEWYORK The first partition contains all rows in which PARTS.PARTNUM (the
primary key) is less than 5000.
\PARIS The second partition contains all rows in which PARTS.PARTNUM is
5000 or greater. An index on the PARTDESC column of table
PARTS, is named IXPART.