Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wK66Y-000aPe-2W for pgsql-performance@arkaria.postgresql.org; Tue, 05 May 2026 03:05:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wK66X-009pig-25 for pgsql-performance@arkaria.postgresql.org; Tue, 05 May 2026 03:05:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wK66X-009piQ-17 for pgsql-performance@lists.postgresql.org; Tue, 05 May 2026 03:05:49 +0000 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wK66U-00000000FE3-3alx for pgsql-performance@postgresql.org; Tue, 05 May 2026 03:05:48 +0000 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-679b072ed3aso2295537eaf.1 for ; Mon, 04 May 2026 20:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777950347; cv=none; d=google.com; s=arc-20240605; b=VCpok+zFRrXncPvspgOweWtbSVa6c1F73gPD5t2PDlBKX91pG0OjpXcKU2box01s+9 cSg3nbhwdm5N7W25tVOTs2u6w8Ie8HDJlzgJx0UMz+w1f89objjOxhzNaWjKpqv2mmJu 7r+pu3tYBC9W1ORrHZzCGutvtxUhY940HNVheURHASyKxsKOSBYyGzyoybUyWhWkmNdf ZJ3nga7mADzk8ljISuTNrbjgPUGW8pebWPsHyirj69feov4lNBqsrmnDlc0+MywL/tu9 ucAi0jfQPVOCi1sAVNN/+w+3iQNwWeeaFW7pvNvksbQ8DiH0Jejz/u2d9jjbdfppMI98 H0uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=dV7Q2uqgRJiFHD4+hr6E94PiDJuxLmJGanqwadLeImA=; fh=XeTRORAoPGzTxwdCvW+Ow07Kb4BJVl9kbt+XxjEgu98=; b=c9ZApW/vYyH/GCwi/u5Zy3fW+tb8Lr4LQ41aU06uBs5/X8MAkKTf6QN9OGeG+S3+9V ISxskRtR8vJ2Gs9bjgFLubHgiz4w4qZh+F+YorjA/fbbnQgGfW9+7foiJFyP1yn0PGKq iOpIh/T1U3pXRP2oQEYtSwVhXX0OhNjZQ7oO2rPTaHX8Ia8zaicvIZ7zd52LLdPkz3Sz YO6fbOfjxcumns3Ca0/pvJ0vqk0HW5/2dS3D3kHCvBcFgNf+pqeQeDxaOJydefVlFtQq 6ued8+AwyjZe7TaOpKpyTXQI63wS3fYqa02yaZX2Zau8qddiME2rLZZ6T+1RhHRuGFLs Px7A==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777950347; x=1778555147; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dV7Q2uqgRJiFHD4+hr6E94PiDJuxLmJGanqwadLeImA=; b=szvkBx0EJDNP1m2L9mJPpOZxc8fOc7FTja8im/IB909LRx3gFvij2MmZcfnpXsTklz b7kRvF8acdLHM/f8gf/ozmIALY6uwW358e/iFZYAib1k2a/wisNKI9bmgKbqcgjoemaC SVSMy1RTrqdWvhHx5ul4k6+Muoor3UYKcpNFJa7QvV6kJXcJPdqt/PoIZTXrSAn8T/to XVDQonyTDKJqVwvSwGph/IJNCWEPUTeqj3S3v08zGC0K3Y1Wazg00GROSlLwr8Q1nObp BOpZTLKykSKvTU6/Uhqk6q3DIInK3KUNfGq+nlBzE3U9RacAXHVLwIi7CUFsGapqEhdQ e9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777950347; x=1778555147; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dV7Q2uqgRJiFHD4+hr6E94PiDJuxLmJGanqwadLeImA=; b=MMwkPN+XznBuqGZT9DkqdjsksxEDFqNd2WrTYx7R8Xbo1lC/Cazsf2+oGME9DyyxJf yBmr/qGzEhFpzlOtG858KkfdQBwlZlGJrO6x4XTdclz94jlni0nfcXXUTg/lyIG2w5Ve 6BQ4VlVphWjG3JcxlzU5MYdPw9uxkFnIj3OPBoXG0x/cwcyhjTxow1MhCaYzAal4hU6B n7FHElqvjyljTof/ulEjt7ivaPsZ1nHTJ73znjMP9KDI3sOOebDyiDxLyvrMaqLHfNlq K0RBZKd5oeXS+iKcoC+q7cLBOPSuEgmEV4oz7fPJHo8YZTxiEqQRcoDvwML0Fo26VqEi EoqQ== X-Gm-Message-State: AOJu0YxG4u7VraNRc3GKPgxBKR9YL+TC3Hk142gJ4J62zxXK5uEPcQ1Q z4QFnsY2LOfj8AdxwDa6IBXIWfkoRJnmH7s+VYk2Qle7dPNDJ9qlvd/HfPUe0alziAiUP/1Be7O h6HY7/bVLFCW6pZSeGzGn3MArp/9qzoE= X-Gm-Gg: AeBDiesZw6vmiySVMplmh2YYW3x+6pCs1LMLinTOBbjrIul6xdqqb1ANlTMpnmgCZcc ZhyqgvTR70BvPuvaNhRQ2rm7ELsua/qRoXIrk2RgLDnT9arKbobsAl4gm8Aj1t4f05Y1M6qLUdi uauZGUSCeEvQ+tnFgW+r15nBI8sJSb+8a+CYlapv4VFioImKArGR1/HLilVNg0dbSG3u0OCQyQX FtH7pYqXKJorWRd3nPjS5I2ZRZwVa0YPQ1Ao41Mq6rDQqvXSkFe6jtbPdV5RFRMyTJSW0lYU4nW ciWLBV5giA5etT0SYHu52c4+Stj84CWLZFbOYhCZhgHBaR5fNCc= X-Received: by 2002:a05:6820:a0e:b0:696:70f0:7ade with SMTP id 006d021491bc7-6998a5789d9mr538884eaf.8.1777950346838; Mon, 04 May 2026 20:05:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sabino Mullane Date: Mon, 4 May 2026 23:05:11 -0400 X-Gm-Features: AVHnY4JeWRGhI5Py3MCLiVM80sgJQ6pitWA_azlhl2CZ-2MBYRDxtow79Omyt4w Message-ID: Subject: Re: Improving insert performance To: =?UTF-8?B?0KDRg9GB0LjQvdC+0LIg0KHQtdC80LXQvQ==?= Cc: "pgsql-performance@postgresql.org" Content-Type: multipart/alternative; boundary="000000000000da08a30651095292" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000da08a30651095292 Content-Type: text/plain; charset="UTF-8" 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 --000000000000da08a30651095292 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You can definitely do better than 35k rps. Setting th= e 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 tri= ed version 18?

By using small string values and CO= PY, 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 potenti= al. Checking wait_events as Laurenz says is a great idea. I'd also do 1= 0 inserts with log_statement=3D'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 - a= re you committing after every insert? That's gonna hurt performance.


Cheers,
Greg

=
--000000000000da08a30651095292--