Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E2203632668 for ; Thu, 8 Jul 2010 18:48:53 -0300 (ADT) 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 35277-07 for ; Thu, 8 Jul 2010 21:48:45 +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 AEFA76324F6 for ; Thu, 8 Jul 2010 18:48:45 -0300 (ADT) Received: (qmail 15231 invoked by uid 512); 8 Jul 2010 21:48:43 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 8 Jul 2010 21:48:43 -0000 Received: from unknown (HELO ?192.168.24.51?) (183.76.21.68) by sd.tpf.co.jp with SMTP; 8 Jul 2010 21:48:43 -0000 Message-ID: <4C3647A1.5010507@tpf.co.jp> Date: Fri, 09 Jul 2010 06:48:17 +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: Rob Richardson CC: pgsql-odbc@postgresql.org Subject: Re: Mysteriously slow query, and side-by-side installation of 8.1 and 8.4 ODBC drivers References: <04A6DB42D2BA534FAC77B90562A6A03D01466014@server.rad-con.local> In-Reply-To: <04A6DB42D2BA534FAC77B90562A6A03D01466014@server.rad-con.local> 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.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: 201007/15 X-Sequence-Number: 10358 Rob Richardson wrote: > Greetings! > > We have a customer running PostgreSQL 8.1. I recently installed a new > version of their application. One piece of the application asks for a > single record from a 100,000-record table. In the previous version of > this application, the query worked well. Now, it takes 8 seconds. > Since the application can run the query 50 or more times, this is not > good. On the other hand, if the user is willing to wait for it, updates > to this table work. > > The ADO recordset is using a client-side cursor. If I change it to a > server-side cursor, the query takes only a few milliseconds. However, > updates no longer work. I get "query-based update failed because the > row to update could not be found". This is true even though there is > only one record in the recordset and the record includes the table's > primary key. > > I do not have this problem when running the application on my own > system, using a PostgreSQL 8.4 database and the latest ODBC driver. I > get good performance using either cursor location. > > A colleague explained the 8-second delay by saying that the entire table > is being downloaded to the client, and only after that does the where > clause of the query get applied. Someone on another list pointed me to > a Microsoft document that seemed to confirm that. I still do not > believe it, since the document said that "the entire result set" gets > downloaded to the client. In this case, the entire result set should > have consisted of a single record. > > The same colleague also suggested trying to install the latest ODBC > driver. I thought that after I did that, I would have a choice of > drivers when creating a new DSN. Instead, the 8.4 ODBC driver replaced > the 8.1 ODBC driver, and every time I tried to update anything, I got a > "multiple errors occured" error message. Could you please try the drivers on testing for 8.4.0201 at http://www.geocities.jp/inocchichichi/psqlodbc/index.html ? > Can anyone suggest a reason for the ultra-slow single-record queries? > Can anyone tell me how to install the 8.4 ODBC driver so that it exists > alongside the 8.1 driver instead of replacing it? > > Thanks very much! > > RobR