"Jim C. Nasby" <jim(at)nasby(dot)net> writes:
> ISTM that we could gain additional insight on how many rows would likely
> result from a join be comparing the "shape" of the histogram for the
> joining columns.
eqjoinsel already does this for the case of comparing the MCV lists.
If you're serious about using the histograms: well, maybe, but it seems
to require far stronger assumptions about the behavior of the datatype
than we use now.
> Am I right about how our estimates work right now? Where can I look in
> the code? Has anyone looked down this path in the past?
src/backend/utils/adt/selfuncs.c
regards, tom lane