Partitioned tables and locks

From: James Sewell <james(dot)sewell(at)jirotech(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Partitioned tables and locks
Date: 2019-12-19 10:04:41
Message-ID: CAANVwEuOb+B9y2P7h0NruC-dAmf2p1xLJSjm5UMXwTBPAxtjvg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is it expected that a lock on a partitioned table will take out 2 locks per
child regardless of the number of children which are excluded at plan time?

For example I can select count(*) from a table with 3500 partitions in
transaction, and see 7000 AccessShareLocks show up till I finish the
transaction.

Bonus question - sometimes if I query pg_locks fast enough I can see ~30K
locks - how could this possibly be the case. This is on an otherwise idle
system.

Cheers,
James

--
The contents of this email are confidential and may be subject to legal or
professional privilege and copyright. No representation is made that this
email is free of viruses or other defects. If you have received this
communication in error, you may not copy or distribute any part of it or
otherwise disclose its contents to anyone. Please advise the sender of your
incorrect receipt of this correspondence.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrey Borodin 2019-12-19 11:04:37 Commit to primary with unavailable sync standby
Previous Message Olivier Gautherot 2019-12-19 09:47:25 Re: READ UNCOMMITTED in postgres