Martijn van Oosterhout <> writes:
> My main problem is that selectivity is the wrong measurement. What
> users really want to be able to communicate is:

> 1. If you join tables a and b on x, the number of resulting rows will be
> the number of roows selected from b (since b.x id a foreign key
> referencing a.x).

FWIW, I believe the planner already gets that case right, because a.x
will be unique and it should know that.  (Maybe not if the FK is across
a multi-column key, but in principle it should get it right.)

I agree though that meta-knowledge like this is important, and that
standard SQL frequently doesn't provide any adequate way to declare it.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to