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 1wLBxA-001bMl-0V for pgsql-performance@arkaria.postgresql.org; Fri, 08 May 2026 03:32:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wLBw3-007QTD-2J for pgsql-performance@arkaria.postgresql.org; Fri, 08 May 2026 03:31:31 +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 1wLBw3-007QT5-1K for pgsql-performance@lists.postgresql.org; Fri, 08 May 2026 03:31:31 +0000 Received: from mail-vk1-xa2a.google.com ([2607:f8b0:4864:20::a2a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wLBw0-00000000k7n-3NUk for pgsql-performance@postgresql.org; Fri, 08 May 2026 03:31:30 +0000 Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-56a8fdaddebso618194e0c.0 for ; Thu, 07 May 2026 20:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778211088; cv=none; d=google.com; s=arc-20240605; b=VklIMgNh3ifxMlOHCHO4MkXIe97p8rnHarNEC7CwwkV9Mv9HTbSybGeOuSPP66mAzK Z90774U7QU2AOJrzWUAMYW0Rh/81pwyGi1DSZ4UON/0ScL2RvgPBkDVPqCEE0mCdJzg3 0EugWevJ/weIFN5a1kYO4zPz2i7QW/KNtB7LYgMIxeZT41SgqdYpnjKAIUBlDN0vP7nk JFgxpIDTnfAtJfeqEPpfklb6Wm18yFJ7GMHLrkgmRQHfM/aH6Tk6rX8daJuflbDUxrGU ZcX4E2/uNSYCH4+UkDKXekHUa7/fZmJcTep4IQRsgp3KrR1rSSzajAYU51pbHT1qMAgk t6/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=PzuySS/eKbeKhsGuCNJ9gRhH/GbknlVlze7PDzmB7Nk=; fh=I7Iw0zbdvtm7EuPAxkgOhToa/9jOWL+38L5yYc6nOMA=; b=EEWdm5tcCkFynQ2JSTdZmjL3o6NYDNcKnYVuSLxTHkCTqCzdSSThzUb7oWw7SVpWOC xU5cCiZ9ns6n3w/jl8BzFIhbYfoYw/qDmxKDovHiyeXPrSKNnmQvmLoKGZewQd3ka35G /hBInDOSlJ+Ag4UVCf7BX6r6k0qI3Q0Pnpt4dSzo6KciREr6NXI4cUfWGrUqcldypDkc VPi/KeuPykm5L4XOjURlzMdmHsaJBBh4lm9hY5Kq3vVfHcZjufS9SqwBeMCIAQoZQ5x+ 0ajeDmfxWnoHhygQn5k2Qv7OjcAKtRQ5o63g3nXFneLS9kz/dNZR7+ZethP6KuznNZe2 DhjQ==; 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=1778211088; x=1778815888; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=PzuySS/eKbeKhsGuCNJ9gRhH/GbknlVlze7PDzmB7Nk=; b=UXz/i3jlDpit/+Nl8eRKuaa5X+f47bHFNLjHmG/U31IL9VZ1gm8kicCrxyqeNh/Iys AEMQPVwyU06fgPnLlXca7G+rFyaLH+pnjUYeQs/AJZ4OuPVpCDRP4TwytLxqMwHDTAeT UkwSD1KmmdHG7JpjQTaK6RZGLBUKY9Kd0Zu2/YZUc9s35ZlsQDheQQ7ZCd+4ESp0lfrt Sw2tZq4tDe+w4JzjvyheUl52//bHq9XVHR331O1RHxrGJ864FNo5j00vR3ZSt+G2aVEZ nT6uzhJDT9Us2mSBlOmvUD31DL+ZueiqCM8y0ioeO7t1tUGu6cJzoa2Vs4RccUy4eLRK Salw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778211088; x=1778815888; h=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=PzuySS/eKbeKhsGuCNJ9gRhH/GbknlVlze7PDzmB7Nk=; b=Pka4w1c7DRvZ+S0XHm2U7AjE8TgDuem6f10ROVkbclArZFD1sAesGgD+yHAxVe0Gmh H1m2xWtHn926CRPTt+cgcg9CGiXIlc+J/564zkuu+yi6PlkRuYLAKMJTqkqU6HD1qrdO gY8xX27F8gLmjgkZ1cZdLOx/hFo/Dv64OUTpOKscmICGSM+EMTglUAGV2hkMSb24v5fZ +NNnICQ5HfapGM/7gXL6iyzL8Gl/dmvLu88bg6U/zPKu4Qk4awed7DpAlvEAoTuHYtQH ZHc7M7zin/2lsbO+yA/p2qH7vBQUM8HDRfvFh17kIWn+wXqyKXVIr8xDKbP9d7J4+VkY pHTg== X-Forwarded-Encrypted: i=1; AFNElJ+ZZnFEIo6zaGa5mgYwMv+IjV+/a6QnUcWEVIJQv3WNhjpAvMCiyXUMJUrTgzKzKTKX/I0IMw6xEvByHmByUOX3Uw==@postgresql.org X-Gm-Message-State: AOJu0Yy/1d6d6d8IB1ofcfPUzS4mU+uYX4ujXaTHYEiSoRc4hL8UWFCQ CwHRTueOnsvhgXEIjMp/MXEjFCN8eH1wmD+VXZtndpKd57QeJW6A8xqT2kaQy9bD+dQPYf2uv+O 4iVwZWTqqIiYxdwo6vfZlj3zubWl2wNk= X-Gm-Gg: AeBDiesdwfRMM//dit+bCgR1vd1CMVLIvrYHD/+oNytd0X0JmcUPIH45cskhjOaa1m4 UnckWmU4UtzzokudvexZRrM4bqpLaM8lWxFSrxqiHv5w+kJf1Bu8IyQXJXdxHFE+i4CzHZyEAkV CvCklR/6GjkFkSDCyrMmHNU6OeXS6S2raMSQN82eCV8zZiWcSMP06dZ4PGGoi3Tlr3DPEfNY6O9 brwCkDtW9iUsyRkr3/f54zGH4dQrWOKBT73mcDH4jcp5WKdwxZzKto+IZAjTu2EbgCBO8zXsqkf zX5YobyvRvoIjOd8qS4= X-Received: by 2002:a05:6102:5716:b0:60f:e47c:f052 with SMTP id ada2fe7eead31-630f904fe6fmr5526758137.25.1778211087309; Thu, 07 May 2026 20:31:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Roland_M=C3=BCller?= Date: Fri, 8 May 2026 06:31:14 +0300 X-Gm-Features: AVHnY4JQMSy8snhGUycSfCYGVKNFpK04uNAEwMffPzcOu5gZGOZg8T3meW9l1m0 Message-ID: Subject: Re: Improving insert performance To: Greg Sabino Mullane , pgsql-performance@postgresql.org, =?UTF-8?B?0KDRg9GB0LjQvdC+0LIg0KHQtdC80LXQvQ==?= Content-Type: multipart/alternative; boundary="00000000000031e10106514608a1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000031e10106514608a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable JDBC is using autocommit by default. You can switch it off and start using explit commits. connection.setAutoCommit(false); Greg Sabino Mullane ezt =C3=ADrta (id=C5=91pont: 2026.= m=C3=A1j. 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? Wh= at > 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=3D'all' on so you can see exactly what the driver and > application are really doing for those inserts. Play around with the thre= ad > 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 > > --00000000000031e10106514608a1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
JDBC is using autocommit by default.

You can switch it off and=C2=A0 start= using=C2=A0 explit commits.

connection.setAutoC= ommit(false);


Gre= g Sabino Mullane <htamfids@gmail.com> ezt =C3=ADrta (id=C5=91pont= : 2026. m=C3=A1j. 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 i= n? Have you tried version 18?

By using small strin= g values and COPY, I can easily get over 1 million rows per second on a sin= gle 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&= #39;d also do 10 inserts with log_statement=3D'all' on so you can s= ee exactly what the driver and application are really doing for those inser= ts. Play around with the thread sizes to find the best combo.
> transactional inserts: yes

This i= s worrisome - are you committing after every insert? That's gonna hurt = performance.


Cheers,
Greg=

--00000000000031e10106514608a1--