SQL/MP Installation and Management Guide

Reorganizing Tables and Maintaining Data
HP NonStop SQL/MP Installation and Management Guide523353-004
8-10
Examples of Loading Tables
1. Start an SQLCI process for each partition. One way to do this is to start each
SQLCI process in the processor associated with the partition to be loaded. Another
way is to start SQLCI processes in the processors associated with the data
sources for the LOAD command.
2. Issue one LOAD...PARTONLY command for each SQLCI process (and thus each
corresponding partition).
3. Supply each LOAD command with the specific range of input data for the partition
it is loading. Three possible strategies are:
Arrange the input data such that it is divided into separate files, each
containing input for a specific target partition. Use these files as input to the
LOAD commands.
Do a SORTED load and specify FIRST KEY. When the SORTED option is
specified, LOAD stops processing input as soon as it encounters a row beyond
the end of the target partition.
Use processes to read input data. Start each data source process as a named
process before entering the LOAD command. Use the process name as the
input file for the LOAD command. The process must wait for requests on its
$RECEIVE file and then supply data by replying to those requests. When using
this approach, be sure to balance processing for optimal performance.
You can use the DataLoader/MP product to help implement the preceding tasks.
For example, you can use DataLoader/MP to arrange to have the input data
delivered to the correct target partitions. For more information about the
DataLoader/MP product, see the DataLoader/MP Reference Manual.
Examples of Loading Tables
This example loads an SQL table from an Enscribe file. The LOAD command moves
the fields in order by using the default MOVEBYORDER option. The fields involved in
the transfer from the source file must be compatible with the data type and order of the
receiving columns in the target table.
>> LOAD $ENSC.SALES.ORDERS, $VOL1.SALES.ORDERS,
+> SCRATCH $TEMP.SCRATCH.JUNK
+> SOURCEDICT $ENSC.SALES SOURCEREC ORDERREC;
The next example loads data from one table into another table. You might perform this
move to increase lengths of existing columns or to drop columns. Columns are
matched by name as specified by the MOVEBYNAME option. The source table must
contain a matching column for each column defined in the target table. The columns
must have compatible data types, but can be of different sizes.
>> LOAD \SYS1.$OLD.SALES.ORDERS, \SYS1.$VOL1.SALES.ORDERS,
+> SORTED
+> TRUNCATION ON
+> MOVEBYNAME;