Re: Lock issues with partitioned table - Mailing list pgsql-general

From Tom Lane
Subject Re: Lock issues with partitioned table
Date
Msg-id 24014.1275573623@sss.pgh.pa.us
Whole thread Raw
In response to Lock issues with partitioned table  ("Jehan-Guillaume (ioguix) de Rorthais" <ioguix@free.fr>)
Responses Re: Lock issues with partitioned table  ("Jehan-Guillaume (ioguix) de Rorthais" <ioguix@free.fr>)
List pgsql-general
"Jehan-Guillaume (ioguix) de Rorthais" <ioguix@free.fr> writes:
> Shouldn't locks only be on tables/indexes that are actually used by the
> planner ?

Well, yeah, they are.  The planner must take at least AccessShareLock
on any relation referenced by the query.  It might later be able to
prove that the relation needn't be scanned to deliver the query answer,
but it first has to lock the relation enough to examine its constraints
before it can prove that.  Similarly, indexes get locked for the purpose
of inspecting them, whether or not they actually get selected for use in
the plan.

AccessShareLock is a weak enough lock that this generally isn't a
problem; all that it's doing is ensuring that the table's schema
doesn't change while we're trying to devise a plan.

            regards, tom lane

pgsql-general by date:

Previous
From: Justin Graf
Date:
Subject: Re: How to debug efficiently
Next
From: Tom Lane
Date:
Subject: Re: so, does this overlap or not...? - fencepost question on overlaps()