Re: Improving N-Distinct estimation by ANALYZE
Jim C. Nasby <jnasby@pervasive.com>
From: "Jim C. Nasby" <jnasby@pervasive.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: josh@agliodbs.com, Simon Riggs <simon@2ndquadrant.com>, pgsql-hackers@postgresql.org
Date: 2006-01-16T18:26:43Z
Lists: pgsql-hackers
On Fri, Jan 13, 2006 at 11:37:38PM -0500, Tom Lane wrote: > Josh Berkus <josh@agliodbs.com> writes: > >> It's also worth mentioning that for datatypes that only have an "=" > >> operator the performance of compute_minimal_stats is O(N^2) when values > >> are unique, so increasing sample size is a very bad idea in that case. > > > Hmmm ... does ANALYZE check for UNIQUE constraints? > > Our only implementation of UNIQUE constraints is btree indexes, which > require more than an "=" operator, so this seems irrelevant. IIRC, the point was that if we know a field has to be unique, there's no sense in doing that part of the analysis on it; you'd only care about correlation. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461