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. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general