Re: Transaction locks on first insert into partitioned table partition - Mailing list pgsql-novice

From David Rowley
Subject Re: Transaction locks on first insert into partitioned table partition
Date
Msg-id CAKJS1f-V+4qStAf2kT37zPo58ESAFJV0GZCLW6GPoYc4OU7E3Q@mail.gmail.com
Whole thread Raw
In response to Re: Transaction locks on first insert into partitioned table partition  (Martin Lund Askøe <martinlundaskoe@gmail.com>)
Responses Re: Transaction locks on first insert into partitioned table partition
List pgsql-novice
On Fri, 7 Jun 2019 at 19:06, Martin Lund Askøe
<martinlundaskoe@gmail.com> wrote:
> Do you know if there is any way to force update the relcache entry during my 'attach'-transaction?

You could just do a dummy insert after the ATTACH PARTITION
transaction ends and before the transaction where you start inserting
the data. Something like:

insert into partition_table_2019_01_01 (id, some_info, e_timestamp)
select 1,'',now() where 1=0;

That'll build and cache the partition bound in the partitions relcache entry.

I'm curious to know why you have concerns about the AccessShareLock on
the partitioned table being held during the insert. Can you explain
that?

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services



pgsql-novice by date:

Previous
From: Martin Lund Askøe
Date:
Subject: Re: Transaction locks on first insert into partitioned table partition
Next
From: Martin Lund Askøe
Date:
Subject: Re: Transaction locks on first insert into partitioned table partition