Re: Q: Performance of join vs embedded query for simple queries? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Q: Performance of join vs embedded query for simple queries?
Date
Msg-id 2305.1155868636@sss.pgh.pa.us
Whole thread Raw
In response to Re: Q: Performance of join vs embedded query for simple queries?  (mark@mark.mielke.cc)
List pgsql-performance
mark@mark.mielke.cc writes:
> That makes sense. Would it be reasonable for the planner to eliminate
> plan considerations based on the existence of unique indexes, or is
> this a fundamentally difficult thing to get right in the general case?

The big obstacle to that at the moment is that we don't have any plan
cache invalidation mechanism; so a plan that depended for correctness on
the existence of a unique index might silently give wrong results after
someone drops the index and inserts non-unique values into the table.
(If the plan actually *uses* the index, then you'd at least get an
access failure ... but if the index was merely used to make an
assumption at plan time, you wouldn't.)

The present "constraint_exclusion" mechanism will actually fail in
exactly this kind of scenario, which is why I insisted it be off by
default :-(

This has been on the radar screen for awhile.  I'd hoped we'd get a
plan invalidation mechanism in place for 8.2, but seems that's not
happening.  Eventually it'll be there, though, and then we can get
more aggressive about making deductions based on constraints.

            regards, tom lane

pgsql-performance by date:

Previous
From: mark@mark.mielke.cc
Date:
Subject: Re: Q: Performance of join vs embedded query for simple queries?
Next
From: alvis
Date:
Subject: Re: Dell PowerEdge 2950 performance