Simon Riggs <simon@2ndQuadrant.com> writes:
> On Fri, 2008-12-12 at 11:16 -0500, Tom Lane wrote:
>> Perhaps a better plan is to try to de-emphasize use of ndistinct,
>> though I concede I have no idea how to do that.
> We don't actually care about the accuracy of the ndistinct much, just
> the accuracy of our answer to the question "given work_mem = X, is it
> better to use a hash plan".
That's hardly the only thing we use ndistinct for. Also, it's a bit too
simplistic to suppose that we only have to make the right binary choice
between hash and something else at a particular plan level. If we don't
have at least ballpark-correct figures for cost and number of output
rows, we'll start making mistakes at higher plan levels.
regards, tom lane