Re: Allowing join removals for more join types - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Allowing join removals for more join types
Date
Msg-id 20140603235053.GA351732@tornado.leadboat.com
Whole thread Raw
In response to Re: Allowing join removals for more join types  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Allowing join removals for more join types  (David Rowley <dgrowleyml@gmail.com>)
Re: Allowing join removals for more join types  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On Wed, May 28, 2014 at 08:39:32PM +1200, David Rowley wrote:
> The attached patch allows join removals for both sub queries with left
> joins and also semi joins where a foreign key can prove the existence of
> the record.

When a snapshot can see modifications that queued referential integrity
triggers for some FK constraint, that constraint is not guaranteed to hold
within the snapshot until those triggers have fired.  For example, a query
running within a VOLATILE function f() in a statement like "UPDATE t SET c =
f(c)" may read data that contradicts FK constraints involving table "t".
Deferred UNIQUE constraints, which we also do not yet use for deductions in
the planner, have the same problem; see commit 0f39d50.  This project will
need a design accounting for that hazard.

As a point of procedure, I recommend separating the semijoin support into its
own patch.  Your patch is already not small; delaying non-essential parts will
make the essential parts more accessible to reviewers.

Thanks,
nm

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: idle_in_transaction_timeout
Next
From: Vik Fearing
Date:
Subject: Re: idle_in_transaction_timeout