>> > One more problem with low ndistinct values is that the condition might >> > very well >> > hit no rows at all. But Idea 1 will largely overestimate the number of >> > hits.
Thats a good point, but I don't see a clear solution. Maybe we could look at past queries and keep track of how often they return empty result sets? It seems that, in some ways, we care about the distribution of the query values in addition to the column values... >> > I think for low ndistinct values we will want to know the exact >> > value + counts and not a bin. So I think we will want additional stats rows >> > that represent "value 'a1' stats". >> >> Isn't that what our most frequent values list does? > > Maybe ? Do we have the relevant stats for each ? > But the trick is to then exclude those values from the histogram bins. Currently, the histogram is only made up of non-mcv values. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers