Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8622087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:58:08+00:00 2026-06-12T06:58:08+00:00

i’m batching updates with jdbc ps = con.prepareStatement(); ps.addBatch(); ps.executeBatch(); but in the background

  • 0

i’m batching updates with jdbc

ps = con.prepareStatement("");
ps.addBatch();
ps.executeBatch();

but in the background it seems, that the prostgres driver sends the query bit by bit to the database.

org.postgresql.core.v3.QueryExecutorImpl:398

 for (int i = 0; i < queries.length; ++i)
            {
                V3Query query = (V3Query)queries[i];
                V3ParameterList parameters = (V3ParameterList)parameterLists[i];
                if (parameters == null)
                    parameters = SimpleQuery.NO_PARAMETERS;

                sendQuery(query, parameters, maxRows, fetchSize, flags, trackingHandler);

                if (trackingHandler.hasErrors())
                    break;
            }

is there a possibility to let him send 1000 a time to speed it up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:58:09+00:00Added an answer on June 12, 2026 at 6:58 am

    AFAIK is no server-side batching in the fe/be protocol, so PgJDBC can’t use it.. Update: Well, I was wrong. PgJDBC (accurate as of 9.3) does send batches of queries to the server if it doesn’t need to fetch generated keys. It just queues a bunch of queries up in the send buffer without syncing up with the server after each individual query.

    See:

    • Issue #15: Enable batching when returning generated keys
    • Issue #195: PgJDBC does not pipeline batches that return generated keys

    Even when generated keys are requested the extended query protocol is used to ensure that the query text doesn’t need to be sent every time, just the parameters.

    Frankly, JDBC batching isn’t a great solution in any case. It’s easy to use for the app developer, but pretty sub-optimal for performance as the server still has to execute every statement individually – though not parse and plan them individually so long as you use prepared statements.

    If autocommit is on, performance will be absolutely pathetic because each statement triggers a commit. Even with autocommit off running lots of little statements won’t be particularly fast even if you could eliminate the round-trip delays.

    A better solution for lots of simple UPDATEs can be to:

    • COPY new data into a TEMPORARY or UNLOGGED table; and
    • Use UPDATE ... FROM to UPDATE with a JOIN against the copied table

    For COPY, see the PgJDBC docs and the COPY documentation in the server docs.

    You’ll often find it’s possible to tweak things so your app doesn’t have to send all those individual UPDATEs at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.