Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Using Table Stats as a user - forum topic by ALovick

$
0
0

I know that Teradata uses stats to define the explain plan, and collect lots myself.
However, we are interested in scanning the cardinality of each column in our new results table.
A query like this first one takes 6 minutes to run per column
SELECT 'Col1' AS ColName, COUNT(DISTINCT Col1) AS Counter FROM DBName.TableName;
Whereas this second one only takes 5 seconds, and we are not that bothered about the sampling estimate being slightly out. 
COLLECT STATS USING SAMPLE ON DBName.TableName COLUMN Col1;
Having collected the stats the results are stored in dbc.columnstats.fieldstatistics, but this is a binary packed field.
So  the question is - is there any way for the user to get at these numbers for personal use?
Thanks,
Tony.
 

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>