Re: odbc vs. libpq performance - Mailing list pgsql-odbc

From Vilches, Alejandro
Subject Re: odbc vs. libpq performance
Date
Msg-id 9CE034E149417949A58AA9A4FA7E1C5584AC9707@ORSMSX109.amr.corp.intel.com
Whole thread Raw
In response to Re: odbc vs. libpq performance  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: odbc vs. libpq performance  ("Vilches, Alejandro" <alejandro.vilches@intel.com>)
List pgsql-odbc
Hi Heikki,

Sorry for taking so long to reply, I was away for a while and came back just recently.

So, before addressing your questions, I discovered something interesting: when connecting via ODBC, transactions are
beingcommitted automatically (even though I'm setting SQL_ATTR_AUTOCOMMIT to SQL_AUTOCOMMIT_OFF).  This would explain
thepoor performance I've been seeing.   

To address your questions:
I'm attaching my little test program connecting via ODBC.  To run it you'll need to create the table (which is pretty
simpleas you'll see from the insert statement).  You'll also need to set the connection parameters.  Finally, you can
playwith the number of threads to try to get different performance results.  To compile you'll need "-lodbc -lpthread
-std=c++0x".

So, I'm wondering: am I just setting the auto commit parameter incorrectly or is it possible that there is a bug
(eitherin unixODBC or the PostgreSQL ODBC driver)? 

I also ran my tests with "log_min_duration_statement = 0" as you suggested.  When connecting via ODBC I do see that
eachinsert statement is taking longer (compared to when I connect via libpq). 

Let me know if you have any questions or if there is any other information I could provide.

Thanks!
Alejandro

-----Original Message-----
From: Heikki Linnakangas [mailto:hlinnaka@gmail.com] On Behalf Of Heikki Linnakangas
Sent: Thursday, April 16, 2015 12:15 AM
To: Vilches, Alejandro; 'pgsql-odbc@postgresql.org'
Subject: Re: [ODBC] odbc vs. libpq performance

On 04/16/2015 03:30 AM, Vilches, Alejandro wrote:
> I have a simple program that inserts data into a single table (see details below).  When I have the program connect
tothe DB via ODBC, performance is significantly slower compared to when I have it connect via libpq.  I was able to
achieve~1000 transactions per second using libpq, but only ~4 transactions per second using the ODBC driver. 

I'd suggest setting log_min_duration_statement = 0 in the server's config file. Then repeat the test and look at the
logfile to see where the time is spent. If that gives no clue, I'm happy to take a look, if you can reproduce it with a
smalltest program and post it to a list. 

- Heikki


Attachment

pgsql-odbc by date:

Previous
From: "intmail01@gmail.com"
Date:
Subject: Re: utf8 data with strange characters
Next
From: Michael Paquier
Date:
Subject: Manifest creation for psqlodbc*.dll