public inbox for pgsql-performance@postgresql.org  
help / color / mirror / Atom feed
From: Roland Müller <rolmur@gmail.com>
To: Greg Sabino Mullane <htamfids@gmail.com>
To: pgsql-performance@postgresql.org
To: Русинов Семен <mrpinkolik@gmail.com>
Subject: Re: Improving insert performance
Date: Fri, 8 May 2026 06:31:14 +0300
Message-ID: <CA+8p0G2TjxcxuJeTy=TLc5vaPWPbAPQwunp3f+r18Q73mt002A@mail.gmail.com> (raw)
In-Reply-To: <CAKAnmmLdeAMr6BSXfqSt-psk_bCsGh=ksyUHRtM9A49DOqsifg@mail.gmail.com>
References: <c3bbe654-939b-467a-9626-8c0938b7347d@gmail.com>
	<CAKAnmmLdeAMr6BSXfqSt-psk_bCsGh=ksyUHRtM9A49DOqsifg@mail.gmail.com>

JDBC is using autocommit by default.

You can switch it off and  start using  explit commits.

connection.setAutoCommit(false);


Greg Sabino Mullane <htamfids@gmail.com> ezt írta (időpont: 2026. máj. 5.,
K 6:05):

> You can definitely do better than 35k rps. Setting the table as unlogged
> is a great start. Are you using prepared queries? Have you tried COPY? What
> is the size of the typical rows going in? Have you tried version 18?
>
> By using small string values and COPY, I can easily get over 1 million
> rows per second on a single thread, on an underpowered and fairly busy
> laptop, to give you a rough idea of potential. Checking wait_events as
> Laurenz says is a great idea. I'd also do 10 inserts with
> log_statement='all' on so you can see exactly what the driver and
> application are really doing for those inserts. Play around with the thread
> sizes to find the best combo.
>
> > transactional inserts: yes
>
> This is worrisome - are you committing after every insert? That's gonna
> hurt performance.
>
>
> Cheers,
> Greg
>
>


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: pgsql-performance@postgresql.org
  Cc: rolmur@gmail.com, htamfids@gmail.com, mrpinkolik@gmail.com
  Subject: Re: Improving insert performance
  In-Reply-To: <CA+8p0G2TjxcxuJeTy=TLc5vaPWPbAPQwunp3f+r18Q73mt002A@mail.gmail.com>

* 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