Archives of the TeradataForum
Message Posted: Tue, 26 Nov 2002 @ 22:46:17 GMT
Subj: | | Re: Show table question |
|
From: | | John Hall |
Anomy Anom wrote:
| We have a maintenance process that queries DBC.TABLES to assemble the primary index text for tables, using a substring starting with
the position of the string 'PRIMARY' and ending at the closing parenthesis. | |
If this is part of an automated process to collect statistics on the primary index, you might adopt a technique that could save you
some work. I normally create my tables so that the PI has a standard name (I use 'PIDX'), for example:
CREATE SET TABLE TEMP.TBL_1
( COL_1 INTEGER
, COL_2 SMALLINT
, COL_3 DATE
)
PRIMARY INDEX PIDX (COL_1, COL_2)
UNIQUE INDEX SIDX_1 (COL_3);
Then I can use the following COLLECT statements:
COLLECT STATISTICS ON TEMP.TBL_1 INDEX PIDX;
COLLECT STATISTICS ON TEMP.TBL_1 INDEX SIDX_1;
If the PI for the table is re-defined, then there's no need to change the COLLECT statement.
|