Redistributes data across the nodes in a nodegroup. The current data distribution, whether it is uniform or skewed, can be specified. The redistribution algorithm selects the partitions to be moved based on the current data distribution.
This API can only be called from the catalog node. Use the LIST DATABASE DIRECTORY command (see the Command Reference) to determine which node is the catalog node for each database.
Scope
This API affects all nodes in the nodegroup.
Authorization
One of the following:
API Include File
sqlutil.h
C API Syntax
/* File: sqlutil.h */ /* API: Redistribute Nodegroup */ /* ... */ SQL_API_RC SQL_API_FN sqludrdt ( char * pNodeGroupName, char * pTargetPMapFileName, char * pDataDistFileName, SQL_PDB_NODE_TYPE * pAddList, unsigned short AddCount, SQL_PDB_NODE_TYPE * pDropList, unsigned short DropCount, unsigned char DataRedistOption, struct sqlca * pSqlca); /* ... */ |
Generic API Syntax
/* File: sqlutil.h */ /* API: Redistribute Nodegroup */ /* ... */ SQL_API_RC SQL_API_FN sqlgdrdt ( unsigned short NodeGroupNameLen, unsigned short TargetPMapFileNameLen, unsigned short DataDistFileNameLen, char * pNodeGroupName, char * pTargetPMapFileName, char * pDataDistFileName, SQL_PDB_NODE_TYPE * pAddList, unsigned short AddCount, SQL_PDB_NODE_TYPE * pDropList, unsigned short DropCount, unsigned char DataRedistOption, struct sqlca * pSqlca); /* ... */ |
API Parameters
Nodes specified in the add list are added, and nodes specified in the drop list are dropped from the nodegroup.
REXX API Syntax
This API can be called from REXX through the SQLDB2 interface. See How the API Descriptions are Organized, or the Embedded SQL Programming Guide. For a description of the syntax, see the Command Reference.
Usage Notes
When a redistribution operation is done, a message file is written to the $HOME/sqllib/redist directory. The file name has the following format:
database-name.nodegroup-name.timestamp
The time stamp value is the time at which the API was called.
This utility performs intermittent COMMITs during processing.
Use the ALTER NODEGROUP statement to add nodes to a nodegroup. This statement permits one to define the containers for the table spaces associated with the nodegroup. See the SQL Reference for details.
Note: | DB2 Parallel Edition for AIX Version 1 syntax, with ADD NODE and DROP NODE options, is supported for users with sysadm or sysctrl authority. For ADD NODE, containers are created like the containers on the lowest node number of the existing nodes within the nodegroup. |
All packages having a dependancy on a table that has undergone redistribution are invalidated. It is recommended to explicitly rebind such packages after the redistribute nodegroup operation has completed. Explicit rebinding eliminates the initial delay in the execution of the first SQL request for the invalid package. The redistribute message file contains a list of all the tables that have undergone redistribution.
It is also recommended to update statistics by issuing sqlustat - Runstats after the redistribute nodegroup operation has completed.
See Also