Bruno Wolff III <bruno@xxxxxxxx> writes: > In this case the test would only be applied when no columns were being used > in a table being joined to. Since that is also an unusual case, if that case > could be quickly checked for, then it might conceivably be worth doing the > more expensive test for the proper not null foreign key relation and unique > constraint. Yeah. Right offhand I think that would be fairly expensive too :-(. The problem is that the query *DOES* have a reference to at least one column of the wide table, namely its join key. So you'd have to distinguish whether any references appear "above" the join. In the current planner structure I think that this information is computed, but not until it's far too late to be removing joins from the tree. regards, tom lane