DISTRIBUTE ON clause for Temporary Tables

A temporary table is like any other base table, but only limited to the session that created that temporary table.

In addition to above, you can also use DISTRIBUTE ON clause with temporary table.

Below is an example:

TESTDB2.ADMIN(ADMIN)=> select version();
VERSION
——————————-
Release 7.2.1.0 [Build 46322]
(1 row)

TESTDB2.ADMIN(ADMIN)=> create temporary table sales_temp(sid integer, cid integer, sqty decimal(5,2)) distribute on (cid);
CREATE TEMP TABLE
TESTDB2.ADMIN(ADMIN)=> \d sales_temp
Table “SALES_TEMP”
Attribute | Type | Modifier | Default Value
———–+————–+———-+—————
SID | INTEGER | |
CID | INTEGER | |
SQTY | NUMERIC(5,2) | |
Distributed on hash: “CID”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: