Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id EA6AB1337BB9 for ; Tue, 21 Dec 2010 15:10:52 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 83067-02 for ; Tue, 21 Dec 2010 19:10:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-px0-f174.google.com (mail-px0-f174.google.com [209.85.212.174]) by mail.postgresql.org (Postfix) with ESMTP id 4D7461337B4F for ; Tue, 21 Dec 2010 15:10:45 -0400 (AST) Received: by pxi15 with SMTP id 15so951907pxi.33 for ; Tue, 21 Dec 2010 11:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=QSMr9XzF6yO3+xTscHNBAJyrdVLX/qJPZfpciQ1wwnA=; b=YqS+Pb4Sw6BVH1KTduoglva6HUPRn30xhuHMmf5M8ISYG1XTKeQ0AGDyBnK790v4jz WKNtnJVOCovHAOKKq0i7WYZ+1yBANLD0c3qDkDK7RCbbpYAiODlDlhj9tZOCc5gB/WES Eboz6RW1RoJzNNkHj0nrba/2PtEmrcTrXXdn4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=RVUTQoeSngjh27bB3RwwOTwySHO97MVlF7pRnqsbde+GuWvUqldcuYkQhX2AxKtpx3 U/3nTM+kxMePrgVe9GPMSq/3+xudQ55HtZUfsp1Dmxh3G/aMgUWJ8NvhRxL6ZbCYa0Si y94BmMLO5JB1tCDk93VqKHyzz29ZtHA0iQihw= Received: by 10.142.165.11 with SMTP id n11mr4848691wfe.380.1292958644370; Tue, 21 Dec 2010 11:10:44 -0800 (PST) Received: from [192.168.0.115] (c-24-17-179-185.hsd1.wa.comcast.net [24.17.179.185]) by mx.google.com with ESMTPS id w14sm7931038wfd.18.2010.12.21.11.10.42 (version=SSLv3 cipher=RC4-MD5); Tue, 21 Dec 2010 11:10:43 -0800 (PST) Message-ID: <4D10FBB1.70104@gmail.com> Date: Tue, 21 Dec 2010 11:10:41 -0800 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 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> In-Reply-To: <3D66EBA5D043E34AADB194828BD4468F1F0714B1@MERCMBX03D.na.SAS.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201012/16 X-Sequence-Number: 10538 On 12/21/2010 09:29 AM, Andriy Rysin wrote: > I have written little test program which takes rows from table in one > database and inserts them into same table in PostgreSQL 9.0. > It can do the inserts either via jdbc or via odbc (09_00_0200 and > unixODBC 2.3.0). The pattern is fairly simple: > > 1. Turn autocommit off > 2. Prepare the insert sql > 3. Fetch row from source table > 4. Bind all columns for insert statement > 5. Perform insert, repeat 3) > 6. When done, commit > > The problem is that jdbc performs pretty well (on par with Oracle DB) > but odbc inserts are about twice as slow: ~70sec vs ~32 for jdbc. My > test was ~70,000 rows and table has 14 columns: NUMBERs, DATEs and small > VARCHARs, 1 numeric primary key and two non-uniqu varchar indeces – > nothing fancy. I measure just the insert timing so select from source > does not impact the benchmark. The test was repeated multiple times with > pretty consistent results. > Can anybody confirm this or have a hint on where to look for the source > of the problem? > Thanks > Andriy 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. -- Adrian Klaver adrian.klaver@gmail.com