Re: Wrong estimate in query plan - Mailing list pgsql-general

From David Johnston
Subject Re: Wrong estimate in query plan
Date
Msg-id 1382624991276-5775785.post@n5.nabble.com
Whole thread Raw
In response to Wrong estimate in query plan  (Eelke Klein <eelke@bolt.nl>)
List pgsql-general
Eelke Klein wrote
> What I noticed is that are no most common values mentioned ofcourse the
> value 1 only occurs once in the column but as all other values are NULL
> you
> could argue it is a common value.

A random sampling is unlikely to choose a record that only appears in 0.1
percent of the table.

Two sequential scans plus a hash seems like a good plan.

The smaller table is so small a sequential scan is fast. The larger table
experts to have all records read so it to should be scanned.  Combining with
a hash seems sound.  The fact the cross-column estimate is way off isn't
that big a deal though I'd be curious to hear Tom's opinion on why this is
so for educational purposes.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Wrong-estimate-in-query-plan-tp5775727p5775785.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


pgsql-general by date:

Previous
From: Rémi Cura
Date:
Subject: Re: GIST index : order Hack : getting the order used by CLUSTER .. USING my_index
Next
From: maillists0@gmail.com
Date:
Subject: Re: Replication and fsync