Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 98749632CCC for ; Mon, 15 Feb 2010 23:58:19 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27708-04 for ; Tue, 16 Feb 2010 03:58:08 +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 48E49632CC7 for ; Mon, 15 Feb 2010 23:58:08 -0400 (AST) Received: (qmail 16611 invoked by uid 512); 16 Feb 2010 03:58:04 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.251) by sd2.tpf-fw-c.co.jp with SMTP; 16 Feb 2010 03:58:04 -0000 Message-ID: <4B7A17C0.5080309@tpf.co.jp> Date: Tue, 16 Feb 2010 12:57:52 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Arnaud Lesauvage CC: pgsql-odbc@postgresql.org Subject: Re: How to speedup inserts via ADO ? References: <4B753720.9060901@codata.eu> In-Reply-To: <4B753720.9060901@codata.eu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201002/12 X-Sequence-Number: 10199 Arnaud Lesauvage wrote: > Hi all ! > > Inserts via ODBC are a lot slower than via native psql connection. > For instance, I have a very basic insert statement that inserts one row > in a table. > If I execute it 1000 times in pgAdmin, it returns in 718ms. > If I execute it via ADO (with a direct query : Connection.Execute > "INSERT INTO..."), it takes 15s to complete. > > I checked psqlODBC's commlog, but all I see in it are the INSERT > statements that I issued. So there must be a lot of overhead somewhere, > but I don't understand where it comes from, and more important I don't > understand how I could get rid of it. > > Are there some connection parameters that I could use to speed things up ? 1. Do inserts in a transction. 2. Set the "Level of rollback on errors" option to Transacion. 3. Use a prepared Command object. regards, Hiroshi Inoue