![]() |
|
Archives of the TeradataForumMessage Posted: Wed, 23 Feb 2005 @ 17:59:27 GMT
After sacrificing a goat on the keyboard, you might want to run this little set of queries I've collected. What you're looking for is: 1) If it's a third normal form type table - 1st - Distribution 2nd - Access 2) If it's a fact type table in a star schema - 1st - Access 2nd - Distribution.
LOCKING Table_in_Question FOR ACCESS
SELECT COUNT(*)
FROM Table_in_Question;
/*****
* NAME: ATM Statistics
* PURPOSE: This calculates the maximum and average number of records per value
* and the number of distinct values, for use in index selection analysis.
* The 1st two should be as close to below the rule-of-thumb value of 100 or 200
* (depending on what era in which you were raised as a T-dba).
* The last should be as distinct as possible.
*****/
LOCKING Table_in_Question FOR ACCESS
SELECT AVG(TheCount) AS AvgRecs,
MAX(TheCount) AS MaxRecs,
COUNT(*) AS DistinctVals
FROM (SELECT COUNT(*) AS TheCount
FROM Table_in_Question
GROUP BY PI_Column1, ..., PI_ColumnN) AS Temp;
/*****
* NAME: Distribution - Mode
* PURPOSE: This determines the "mode" of the distribution of a specific index.
* NOTE: The mode is the score in the population that occurs most frequently.
* (Internet Glossary of Statistical Terms:
Anyway, there's a whole section in the manuals on index selection. If the PI's never joined on, it'll never get any use for access, so it'd better be the only column that distributes well. (Donning helmet for flying bricks...) con respeto, iv
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||