Re: Question on cardinality, statistics, and when things go stale

2010-11-19 Thread Kristian Waagan
On 18.11.10 20:27, Bergquist, Brett wrote: Thanks for the explanation! So if I understand this correctly, if the indexes that I am querying on are always unique (the computed value that is index is always unique), then as long as the optimizer knows about these statistics (ie I have run "sysc

RE: Question on cardinality, statistics, and when things go stale

2010-11-18 Thread Bergquist, Brett
trigali [mailto:mikem_...@sbcglobal.net] Sent: Thursday, November 18, 2010 1:51 PM To: derby-dev@db.apache.org Subject: Re: Question on cardinality, statistics, and when things go stale derby uses 2 types of statistics, for this discussion I will call them distribution and cardinality. For distrib

Re: Question on cardinality, statistics, and when things go stale

2010-11-18 Thread Mike Matrigali
derby uses 2 types of statistics, for this discussion I will call them distribution and cardinality. For distribution derby uses the index themselves at query compile time, so this info never goes stale. For distribution the optimizer might need to know what percentage of the keys in an index ar

Question on cardinality, statistics, and when things go stale

2010-11-18 Thread Bergquist, Brett
I have read as much as I can about this subject and am a little confused. I understand the cardinality statistics are not computed if the tables are empty when indexes are created and I can work around that. Say I have a table with 15 million records in it and there is a main index that I need