Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Merlin Moncure
On Thu, Dec 16, 2010 at 7:14 AM, Richard Huxton wrote: > 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

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Richard Huxton
On 16/12/10 12:28, Werner Scholtes wrote: 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 paramete

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Werner Scholtes
l-performance-ow...@postgresql.org [mailto:pgsql-performance- > ow...@postgresql.org] Im Auftrag von Richard Huxton > Gesendet: Donnerstag, 16. Dezember 2010 13:15 > An: Werner Scholtes > Cc: Divakar Singh; pgsql-performance@postgresql.org > Betreff: Re: [PERFORM] performance libpq vs JDBC

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Richard Huxton
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 th

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Divakar Singh
ql.org] Im Auftrag von Divakar Singh Gesendet: Donnerstag, 16. Dezember 2010 10:38 An: Werner Scholtes; pgsql-performance@postgresql.org Betreff: Re: [PERFORM] performance libpq vs JDBC If you have all records before issuing Insert, you can do it like: insert into xxx values (a,b,c), (d,e,f), ..;

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Werner Scholtes
: Donnerstag, 16. Dezember 2010 10:38 An: Werner Scholtes; pgsql-performance@postgresql.org Betreff: Re: [PERFORM] performance libpq vs JDBC If you have all records before issuing Insert, you can do it like: insert into xxx values (a,b,c), (d,e,f), ..; an example: http://kaiv.wordpress.com

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Divakar Singh
Singh ; "pgsql-performance@postgresql.org" Sent: Thu, December 16, 2010 2:51:53 PM Subject: RE: [PERFORM] performance libpq vs JDBC Unfortunately I cannot use COPY funtion, since I need the performance of JDBC for update and delete statements in C++ libpq-program as well. I wonde

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Werner Scholtes
11 An: Werner Scholtes; pgsql-performance@postgresql.org Betreff: Re: [PERFORM] performance libpq vs JDBC Can you trying writing libpq program using COPY functions? I hope it will be better than prepared statements. Best Regards, Divakar From: Werner Scholtes To: &

Re: [PERFORM] performance libpq vs JDBC

2010-12-16 Thread Divakar Singh
: [PERFORM] performance libpq vs JDBC I wrote a test program in C++ using libpq. It works as follows (pseudo code): for( int loop = 0; loop < 1000; ++loop ) { PQexec("BEGIN"); const char* sql = "INSERT INTO pg_perf_test (id, text) VALUES($1,$2)"; PQprepare(m_conn,"s

[PERFORM] performance libpq vs JDBC

2010-12-15 Thread Werner Scholtes
I wrote a test program in C++ using libpq. It works as follows (pseudo code): for ( int loop = 0; loop < 1000; ++loop ) { PQexec("BEGIN"); const char* sql = "INSERT INTO pg_perf_test (id, text) VALUES($1,$2)"; PQprepare(m_conn, "stmtid",sql,0,NULL); for ( int i = 0; i < 1000; ++i )