Martijn van Oosterhout <kleptog@svana.org> writes:
> Note, the planner does have most of the intelligence needed to
> determine when it can skip a partition.

The issue isn't really whether the planner *could* use a constraint
to decide that a table need not be scanned at all.  As you say, we
have practically all the infrastructure needed for such inferences.
To me the real reason why we don't do that is the lack of a mechanism
to force the plan to be reconsidered if the constraint is dropped.
Without the constraint, the plan will still run, but it may deliver
wrong answers.  (The closest current equivalent is the possibility of
dropping an index that a plan depends on --- but at least we will fail
outright if the index isn't there anymore.)

In short, I won't accept any such patch until after we build a mechanism
for invalidating cached plans.  Which we need anyway for other reasons.
So the path ahead is clear, in my mind anyway ... but this is not the
next step to take.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to