From: | Werner Scholtes <Werner(dot)Scholtes(at)heuboe(dot)de> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Divakar Singh <dpsmails(at)yahoo(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: performance libpq vs JDBC |
Date: | 2010-12-16 12:28:51 |
Message-ID: | 128DB53227227D43B4AAEED73E89A81901E2C4B590@vm-exchg-2k8.heuboe.hbintern |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Thanks a lot for your advice. I found the difference: My Java program sends one huge SQL string containing 1000 INSERT statements separated by ';' (without using prepared statements at all!), whereas my C++ program sends one INSERT statement with parameters to be prepared and after that 1000 times parameters. Now I refactured my C++ program to send also 1000 INSERT statements in one call to PQexec and reached the same performance as my Java program.
I just wonder why anyone should use prepared statements at all?
> -----Ursprüngliche Nachricht-----
> Von: pgsql-performance-owner(at)postgresql(dot)org [mailto:pgsql-performance-
> owner(at)postgresql(dot)org] Im Auftrag von Richard Huxton
> Gesendet: Donnerstag, 16. Dezember 2010 13:15
> An: Werner Scholtes
> Cc: Divakar Singh; pgsql-performance(at)postgresql(dot)org
> Betreff: Re: [PERFORM] performance libpq vs JDBC
>
> On 16/12/10 09:21, Werner Scholtes wrote:
> > I assume that the wire protocol of PostgreSQL allows to transmit
> > multiple rows at once, but libpq doesn't have an interface to access
> it.
> > Is that right?
>
> Sounds wrong to me. The libpq client is the default reference
> implementation of the protocol. If there were large efficiencies that
> could be copied, they would be.
>
> Anyway - you don't need to assume what's in the protocol. It's
> documented here:
> http://www.postgresql.org/docs/9.0/static/protocol.html
>
> I'd stick wireshark or some other network analyser on the two sessions
> -
> see exactly what is different.
>
> --
> Richard Huxton
> Archonet Ltd
>
> --
> Sent via pgsql-performance mailing list (pgsql-
> performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
From | Date | Subject | |
---|---|---|---|
Next Message | selvi88 | 2010-12-16 12:33:07 | postgres performance tunning |
Previous Message | Richard Huxton | 2010-12-16 12:14:32 | Re: performance libpq vs JDBC |