Palle Girgensohn <girgen@pingpong.net> writes:
> Interesting. Yes, I might be that desperate, actually. As desperate as 30 s
> vs 30 ms can get me... :)
> And this one would actually accumulate stats alright? Looks kinda hairy to
> me. It's not really a partial index anymore, but I guess that doesn't
> matter...
Yeah, it would. The trick is finding a mapping function that will map
all the cases you care about to distinct values.
> How is the behaviour on 7.4 for this stuff? It seems 7.4 does use the
> partial index, but not always, as shown in a previous mail. Will this
> example work on both versions, or just for 8.0?
7.4 doesn't keep stats on functional indexes, so the hack is a
nonstarter there.
I am not sure why you are seeing different results on 7.4 than 8.0 for
the original example --- 7.4 is certainly not smarter than 8.0, and we
seem to have ruled out the idea that some sort of glitch is confusing
the 8.0 planner.
regards, tom lane