pair_name
Name component of a query band specification.
The maximum size for each pair_name is 128 UNICODE characters. For more information about database object names, see Object Names.
The number of pair_name=pair_value pairs is limited to the maximum length of the string, which is 4,096 UNICODE characters, including pad characters.
Enclose the set of name=value pairs for the query band in APOSTROPHE characters. To embed an APOSTROPHE character in a pair name, type it twice. Otherwise, it is interpreted as a pair_name=pair_value string terminator.
- EQUALS SIGN (=)
- SEMICOLON (;)
- NULL
For a list of reserved query band names, see "Reserved Query Band Names and Values" in Query Bands and Load Utilities.
pair_value
Value component of a query band specification.
pair_value can be up to 256 VARCHAR UNICODE characters in length.
The number of name=value pairs is limited to the maximum length of the string, which is 2,048 UNICODE characters, including pad characters.
- SEMICOLON (;)
- NULL
To embed an APOSTROPHE character in a pair value, type it twice. Otherwise, it is interpreted as a pair_name =pair_value string terminator.
pair_value | Binpacking Algorithm |
---|---|
0 (Default) | Distributes files across AMPs based on rowgroup boundaries (parallel distribution). |
1 | Distributes files across AMPs based on file size, balancing load across all AMPs. Can cause skew if there are fewer files than AMPs or if files are of significantly different sizes. |
2 | Same as 0. |
NONE
The previously specified query band is to be removed for the current session or transaction.
You cannot specify both the NONE option and the UPDATE option within the same request.
An APOSTROPHE-enclosed null string is equivalent to NONE.
UPDATE
- If the query band name matches a name in the current query band, then Vantage replaces the value.
- If the query band name does not match a name in the current query band, then Vantage adds the name:value pair.
The only way to remove a name:value pair from a query band is to replace the entire query band.
If an update causes the new query band to exceed the maximum allowable length, Vantage returns an error to the requestor.
A name can be set to a zero-length string by specifying the following:
'pair_name;'
If you do not specify UPDATE, then the entire current query band is replaced by the new query band.
You cannot specify both the NONE option and the UPDATE option within the same request.
FOR SESSION
The set of name:value pairs applies to the current session.
You can set a session query band concurrently with an existing transaction query band.
Session query bands are stored in DBC.SessionTbl and are recovered after a system reset. The system populates additional columns in DBC.SessionTbl for a trusted session and uses the information in these session proxy columns to recover a trusted session after a system reset.
- SET QUERY_BAND FOR SESSION request to reset the query band.
- SET QUERY_BAND NONE FOR SESSION request.
- In a macro definition, as the single request in the macro.
- With Teradata Parallel Transporter.
- Multiple-statement requests.
- SQL procedure definitions.
- VOLATILE
- The system does not update the queryband column of DBC.SessionTbl and the FOR SESSION request is equivalent to a FOR TRANSACTION request.
FOR TRANSACTION
The query band set specified by the set of name:value pairs applies to the current transaction.
You can set a transaction query band concurrently with an existing session query band.
Only one transaction query band can be active at a time.
As each SET QUERY_BAND FOR TRANSACTION request in a transaction runs, its query band replaces the current transaction query band.
If you specify SET QUERY_BAND FOR TRANSACTION in a multiple-statement request, you must specify it as the first request. In a multiple-statement request, Vantage applies only one transaction query band to all statements in the request. Teradata Active Systems Management (TASM) classification occurs only once for all statements in a multiple-statement request.
- ? parameter in a Java or ODBC program.
- Macro.
- SQL procedure.
For these cases only, Vantage does not apply the trusted session privileges to the statements in the multiple-statement request. Therefore, you can specify only one SET QUERY_BAND FOR TRANSACTION statement per multiple-statement request.
The query band for a transaction is not stored in DBC.SessionTbl.
Vantage does not restore the current transaction query band after a system restart.
SET QUERY_BAND FOR TRANSACTION is supported for both macros and SQL procedures.
SET QUERY_BAND FOR TRANSACTION is not supported for Teradata Parallel Transporter.
The following process shows a use case for query bands in the context of a SET QUERY_BAND FOR TRANSACTION request.
- A web service, implemented in Java, responds to an HTTP/SOAP (Hypertext Transfer Protocol/Simple Object Access Protocol) request.
- The web service uses JTA (Java Transaction API) to begin a user-managed transaction.
- The web service gets a JDBC connection from a connection pool managed by the application server.
- The web service uses JDBC (Java Database Connectivity) to submit the SQL request to establish the query band for the transaction.
- The web service invokes multiple Enterprise Java Beans (EJBs). For example, the first EJB inserts a row into table A, and the second EJB updates rows in table B. All calls to the EJBs participate in the same transaction, and therefore are identified with the same query band.
- The web service commits the transaction.
The query band value for the transaction is automatically cleared, so any subsequent SQL requests submitted on the pooled connection have a different query band value.