"Jehan-Guillaume (ioguix) de Rorthais" <ioguix@xxxxxxx> 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general