From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | stange(at)rentec(dot)com |
Cc: | Kris Jurka <books(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: executeBatch() issue with new driver? |
Date: | 2004-11-02 21:19:19 |
Message-ID: | 4187F9D7.3060308@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Alan Stange wrote:
> What about this case:
>
> Connection conn = ...
> Statement st = conn.createStatement();
> st.execute("insert a; insert b; insert c; insert d;");
>
> Is the 8.0 driver busting this up into 4 trips to the database?!
No, but it must split that query string into 4 individual queries (a V3
extended-query-protocol requirement). So it will send:
Parse("insert a")
Bind(...)
Execute(...)
Parse("insert b")
Bind(...)
Execute(...)
Parse("insert c")
Bind(...)
Execute(...)
Parse("insert d")
Bind(...)
Execute(...)
Sync
Then it starts reading responses from the server.
The driver does exactly the same thing if you do:
st.addBatch("insert a");
st.addBatch("insert b");
st.addBatch("insert c");
st.addBatch("insert d");
st.executeBatch();
If you're interested in the gory protocol details, take a look at
http://www.postgresql.org/docs/7.4/static/protocol-flow.html#AEN52666
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Jan de Visser | 2004-11-02 21:22:07 | Re: 1300 to 3100 lines of code for XA support |
Previous Message | Aaron Mulder | 2004-11-02 21:12:10 | Re: 1300 to 3100 lines of code for XA support |