Re: Q: Performance of join vs embedded query for simple queries?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mark(at)mark(dot)mielke(dot)cc
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Q: Performance of join vs embedded query for simple queries?
Date: 2006-08-18 02:37:16
Message-ID: 2305.1155868636@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

mark(at)mark(dot)mielke(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message alvis 2006-08-18 09:21:29 Re: Dell PowerEdge 2950 performance
Previous Message mark 2006-08-18 02:30:32 Re: Q: Performance of join vs embedded query for simple queries?