How to view statistics?

Database

How to view statistics?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"TD collects stats by measuring a large number of rows and then placing the statistics in USER DBC."
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
How do i view these? Do i need to view using TD Administrator? If so, how?

Regards
Varun R
3 REPLIES

Re: How to view statistics?

The collected statistics are stored in DBC.TVFields.FieldStatistics and DBC.Indexes.IndexStatistics.

They can be viewed in a more readable but highly abbreviated form using the "help statistics" SQL statement.

Re: How to view statistics?

thanks...i jus now got the same answer from a colleague.
When i did a help stats, i got the following

Date Time Unique Values Column Names
07/05/03 13:15:04 22,944 ROW_ID

So what good is this info? How does the PE use this to do anything? And will these be the only cols ever on a collect stats?

And how to collect stats on more than one col?

Collect stats on column ,??? Do i do it like this?

Regards
Varun R

Re: How to view statistics?

More detailed stats at the column level can be found with:

HELP STATS dbname.tablename COLUMN(colname);

This gives you the histogram that is created when the "COLLECT STATS" is executed.

If you want to gather multi-column stats, the syntax is:

COLLECT STATS ON dbname.tablename COLUMN(col1, col2, etc.);

They can also be collected on an index:

COLLECT STATS ON dbname.tablename INDEX(col1,col2,etc.);

though I don't know of any advantage to collecting them on an index as opposed to collecting on multiple columns.