Bruce Momjian <bruce@momjian.us> writes:
> Why is selfuncs.c::var_eq_const() doing a linear scan over the MCV array
> instead of having the list sorted and doing a binary search on the
> array?
1. Keeping the MCV array sorted by frequency allows cheap extraction
of less-accurate MCV lists; you just take the first N entries.
2. Binary search presumes that you have a less-than operator, a concept
not implicit in the notion of MCVs (but it *is* implicit in a
histogram).
regards, tom lane