Re: Improving insert performance

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Русинов Семен <mrpinkolik(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Improving insert performance
Date: 2026-05-05 03:05:11
Message-ID: CAKAnmmLdeAMr6BSXfqSt-psk_bCsGh=ksyUHRtM9A49DOqsifg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Roland Müller 2026-05-08 03:31:14 Re: Improving insert performance
Previous Message Jeff Davis 2026-05-05 01:27:03 Re: Significant performance issues with array_agg() + HashAggregate plans on Postgres 17