Re: Partitioned tables and locks

From: James Sewell <james(dot)sewell(at)jirotech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Partitioned tables and locks
Date: 2019-12-19 21:42:58
Message-ID: CAANVwEvXZ40q2yYYKmz1eXNKybK6s2yhOzhid4DbGma4HeEvkw@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?
>
> Depends on the details of your query, and on which PG version you're
> using, but it's by no means surprising for each child table to get
> locked. (I'm not sure where *two* locks would come from, though.)

The queries were just select count(*) both with a where clause which
excludes some partitions and without, I’m on 11.

The table has over 3K partitions

>
>
> If you're working with massively partitioned tables, increasing
> max_locks_per_transaction is a good idea.

It’s 256 at the moment, with 600 connections - guess I need more.
--
James Sewell,
Chief Architect

Suite 112, Jones Bay Wharf, 26-32 Pirrama Road, Pyrmont NSW 2009
P (+61) 2 8099 9000 W www.jirotech.com F (+61) 2 8099 9099

--
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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message James Sewell 2019-12-19 21:55:22 Re: Max locks
Previous Message Ron 2019-12-19 15:32:26 Re: Experiencing error during restore - found unexpected block ID (0)