Archives of the TeradataForum
Message Posted: Tue, 16 Dec 2003 @ 10:14:31 GMT
Subj: | | Re: How much statistics to collect |
|
From: | | David Clough |
Martin O'Brian writes
| It can actually be more important to collect stats on a column which has only 2 values. If Teradata does not have stats on that
column then it uses default statistics ( if stats have been collected on any other column/index of the table) . The default statistics are
going to assume a lot more than two distinct values. This implies that if that column is used as a predicate and there are no stats on this
column , Teradata is going to assume that a lot fewer rows are going to qualify as a result of the predicate. This could cause bad access
paths. | |
This news concerns me somewhat, as one school of thought in our shop (please excuse the mixed metaphor) is that for low cardinality
columns - where there are no Statistics at all on the column - Dynamic Random Amp Sampling ('DRAS') would produce an adequate Explain
Plan.
Having tried an example, however, I can certainly confirm that Martin is indeed correct and found that Teradata would appear to take the
cardinality of the Primary Index as its basis for arriving at the (no confidence) Explain estimate.
My example was based on pretty small tables, but I assume the principle would extend to larger ones.
Can anyone shed any light on the situations in which 'DRAS' would come into play (ooh, another mixed metaphor) ?
Dave Clough
Database Designer
Database Design Group
|