Re: IO related waits

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: veem v <veema0000(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, Christophe Pettus <xof(at)thebuild(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: IO related waits
Date: 2024-09-20 20:47:08
Message-ID: 2587192.1726865228@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

veem v <veema0000(at)gmail(dot)com> writes:
> Able to reproduce this deadlock graph as below. Now my question is , this
> is a legitimate scenario in which the same ID can get inserted from
> multiple sessions and in such cases it's expected to skip that (thus "On
> conflict Do nothing" is used) row. But as we see it's breaking the code
> with deadlock error during race conditions where a lot of parallel threads
> are operating. So how should we handle this scenario?

Do you have to batch multiple insertions into a single transaction?
If so, can you arrange to order them consistently across transactions
(eg, sort by primary key before inserting)?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2024-09-20 21:04:24 Re: IO related waits
Previous Message veem v 2024-09-20 20:01:23 Re: IO related waits