Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CA9A91336B42 for ; Tue, 21 Dec 2010 23:51:49 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 66935-01 for ; Wed, 22 Dec 2010 03:51:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by mail.postgresql.org (Postfix) with SMTP id 0C3771337BBA for ; Tue, 21 Dec 2010 23:51:40 -0400 (AST) Received: (qmail 13316 invoked by uid 512); 22 Dec 2010 03:51:42 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.252) by sd2.tpf-fw-c.co.jp with SMTP; 22 Dec 2010 03:51:42 -0000 Message-ID: <4D1175C0.3070709@tpf.co.jp> Date: Wed, 22 Dec 2010 12:51:28 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Andriy Rysin CC: "pgsql-odbc@postgresql.org" Subject: Re: pgsqlodbc 09_00_0200 is twice as slow on inserts as jdbc driver References: <3D66EBA5D043E34AADB194828BD4468F1F0714B1@MERCMBX03D.na.SAS.com> <4D10FBB1.70104@gmail.com> <4D110C7A.6090103@sas.com> <4D113D1E.4080405@tpf.co.jp> <4D11739E.5000907@sas.com> In-Reply-To: <4D11739E.5000907@sas.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.242 tagged_above=-10 required=5 tests=BAYES_00=-1.9, DNS_FROM_RFC_BOGUSMX=1.668, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/20 X-Sequence-Number: 10542 (2010/12/22 12:42), Andriy Rysin wrote: > On 12/21/2010 6:49 PM, Hiroshi Inoue wrote: >> (2010/12/22 5:22), Andriy Rysin wrote: >>> On 12/21/2010 2:10 PM, Adrian Klaver wrote: >>>> One to thing look at is whether you have logging turned on in ODBC, >>>> this really slows things down. In any case I have never found ODBC to >>>> be particularly fast in comparison to other interfaces. >>> well, the tracing is turned off, but I also found two things: >>> 1) the DB server has a bit lower CPU load when using ODBC driver (30% vs >>> 35% with jdbc) and the machine running the program has a bit higher CPU >>> load with (6-7% vs 5% with jdbc) >>> 2) pg_stat_activity shows proper prepared statement when using jdbc, >>> something like: >>> insert into my_table (col1, col2) values ($1, $2) >>> but when I use ODBC driver the statement looks like a non-prepared one: >>> insert into my_table (col1, col2) values (2024443, E'MYTEXT1') >>> >>> I wander if pgsql odbc driver does not support prepared statement (or I >>> need to turn some flag on) >> >> Do you call SQLPrepare() for the query? >> And are you turning on the *Server side prepare* option? > Thanks Hiroshi, > I do call SQLPrepare(), SQLBindParameter() and SQLExecut() but I did not > set the Server side prepare option. After I did set the option to "1" I > got this: > 1) the statement in pg_stat_activity looks like "EXECUTE > "_PLAN0x2c9afaee80"(10195,'86765865'...)" - still not like it should > "insert into my_table (col1, col2) values ($1, $2)" Hmm, are you setting the Protocol to 7.4+? > 2) SQLBindParameter() got sensitive to the data types when I bind NULL > parameter (before it didn't really care - SQL_CHAR worked for any column) > 3) the speed didn't improve much (the change was about 1-2%) > > Andriy