On Tue, Mar 31, 2015 at 12:02 PM, Tomas Vondra <tomas.von...@2ndquadrant.com > wrote:
> Hi all, > > attached is v4 of the patch implementing adaptive ndistinct estimator. > Hi Tomas, I have a case here where the adaptive algorithm underestimates ndistinct by a factor of 7 while the default estimator is pretty close. 5MB file: https://drive.google.com/file/d/0Bzqrh1SO9FcETU1VYnQxU2RZSWM/view?usp=sharing # create table foo2 (x text); # \copy foo2 from program 'bzcat ~/temp/foo1.txt.bz2' # analyze verbose foo2; INFO: analyzing "public.foo2" INFO: "foo2": scanned 6021 of 6021 pages, containing 1113772 live rows and 0 dead rows; 30000 rows in sample, 1113772 estimated total rows WARNING: ndistinct estimate current=998951.78 adaptive=135819.00 Cheers, Jeff