public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: veem v <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Cc: Christophe Pettus <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: IO related waits
Date: Wed, 18 Sep 2024 14:32:48 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB+=1TWhGgybtCdU7oR3oghhXG6vULUEkebG1DbT+bc1v7yp4w@mail.gmail.com>
References: <CAB+=1TWZNvMhVthJ2iKs_Q4qBzMw-v_oaSz7HbFE_P_qC5jMFA@mail.gmail.com>
<[email protected]>
<CAB+=1TWdRd2sBw7-vXCovH_VHLANh+aSaU-WyJ2m8tL4TkF=8g@mail.gmail.com>
<[email protected]>
<CAB+=1TV-b8=RGKVFN0qj5Nxdgbj-JYCNh4ZqFjxxmQPpFD6=PQ@mail.gmail.com>
<[email protected]>
<CAB+=1TXn-TZFC5QAFDshpRpnNhGrZ847sdaivNJRgot-6BuerA@mail.gmail.com>
<CAB+=1TWhGgybtCdU7oR3oghhXG6vULUEkebG1DbT+bc1v7yp4w@mail.gmail.com>
On 9/18/24 1:40 PM, veem v wrote:
>
> You were spot on. When we turned off the "auto commit" we started
> seeing less number of commits as per the number of batches.
>
> However we also started seeing deadlock issues. We have foreign key
> relationships between the tables and during the batch we do insert
> into the parent first and then to the child , but this does happen
> from multiple sessions for different batches. So why do we see below
> error, as we ensure in each batch we first insert into parent and
> then into the child tables?
>
> caused by: org.postgresql.util.PSQLException: ERROR: deadlock detected
> Detail: Process 10443 waits for ShareLock on transaction
> 220972157; blocked by process 10454.
> Process 10454 waits for ShareLock on transaction 220972155; blocked
> by process 10443.
> Hint: See server log for query details.
> Where: while inserting index tuple (88736,28) in relation
> "TAB1_p2024_08_29"
>
>
> As we are able to get hold of one session, we see "insert into <parent
> partition table>" was blocked by "insert into <child partition table>".
> And the "insert into <child partition table> " was experiencing a
> "client read" wait event. Still unable to understand why it's happening
> and how to fix it?
This needs clarification.
1) To be clear when you refer to parent and child that is:
FK
parent_tbl.fld <--> child_tbl.fld_fk
not parent and child tables in partitioning scheme?
2) What are the table schemas?
3) What is the code that is generating the error?
Overall it looks like this process needs a top to bottom audit to map
out what is actually being done versus what needs to be done.
--
Adrian Klaver
[email protected]
view thread (17+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: IO related waits
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox