X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 756D2D1B1CD for ; Fri, 30 Jul 2004 16:03:36 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 77136-08 for ; Fri, 30 Jul 2004 19:03:33 +0000 (GMT) Received: from gk-us2.michelin.com (gk-us2.michelin.com [156.65.14.19]) by svr1.postgresql.org (Postfix) with ESMTP id 9F7F7D1B1FD for ; Fri, 30 Jul 2004 16:03:25 -0300 (ADT) Received: from ONCMH1.onc.michelin.com (unverified) by gk-us2.michelin.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Fri, 30 Jul 2004 14:46:32 -0400 Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Fri, 30 Jul 2004 14:49:15 -0400 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id I1OHSW00.NTS for ; Fri, 30 Jul 2004 14:53:20 -0400 Received: from us.michelin.com (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Fri, 30 Jul 2004 14:53:20 -0400 Message-Id: <410A991F.2070502@us.michelin.com> Date: Fri, 30 Jul 2004 14:53:19 -0400 From: "Greg Campbell" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brev Patterson Cc: pgsql-odbc@postgresql.org Subject: Re: Pg/ODBC driver connection discovery and speed References: <6.1.2.0.0.20040730114621.02401ad0@mail.141.com> In-Reply-To: <6.1.2.0.0.20040730114621.02401ad0@mail.141.com> Content-Type: multipart/mixed; boundary="------------070402050300080909010005" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_RFCI X-Spam-Level: X-Archive-Number: 200407/174 X-Sequence-Number: 4307 This is a multi-part message in MIME format. --------------070402050300080909010005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit ...some Shipping software. Homegrown? Purchased? Contracted? I doubt that type of schema discovery is needed for each Update. I wonder if the "shipping software" is using a recordset update (DAO .Edit/.Update or ADO recordset.Update) as opposed to pass-through style SQL INSERTS, and UPDATE, which barring a poorly designed database and index structure, should be lightning fast. Brev Patterson wrote: > Hello list, > > I've searched through FAQs, docs, and the mailing list about this > problem, but haven't found anything, so I hope this isn't a repeat. > > I've got a windows machine running some Shipping software, connected > to a postgresql 7.4 database via the Postgres/ODBC driver, behind a > secure stunnel connection. > > On SELECT's from this windows machine, everything is great: The > driver connects, discovers the info it needs, and then that connection > stays open as we do SELECT after SELECT, and it works great. > > After the SELECTs, we do UPDATEs back to the database, sending back > Tracking # and weight Information. Instead of connecting, > discovering, and then UPDATING on that connection over and over, each > UPDATE connection is separate. So, > for every UPDATE, there is a new connection, a new discovery, etc. > > Now, our database is quite large. The ODBC driver runs queries like > this (this is what I mean by "discovery"): > > Jul 30 11:35:05 tenzing postgres[1515]: [253-1] LOG: statement: > select u.nspname, c.relname, a.attname, a.atttypid, t.typname, > a.attnum, a.attlen, a.at ttypmod, a.attnotnull, > Jul 30 11:35:05 tenzing postgres[1515]: [253-2] c.relhasrules, > c.relkind from pg_catalog.pg_namespace u, pg_catalog.pg_class c, > pg_catalog.pg_attribute a, pg_catalog.pg_type t > Jul 30 11:35:05 tenzing postgres[1515]: [253-3] where u.oid = > c.relnamespace and (not a.attisdropped) and c.oid= a.attrelid and > a.atttypid = t.oid and (a.attnum > 0) and > Jul 30 11:35:05 tenzing postgres[1515]: [253-4] c.relname like > 'category_subcat' and u.nspname like 'bcs' order by u.nspname, > c.relname, attnum > Jul 30 11:35:05 tenzing postgres[1515]: [254-1] LOG: duration: 2.503 ms > > on every object/table/etc in our whole database. This ends up taking > 5 to 7 seconds. > > Our warehouse workers have to sit there for many seconds after a > package has shipped, waiting for each UPDATE connection to do this > discovery, before the actual UPDATE is done. (The actual UPDATE query > itself is very fast). > > During Christmas, we're going to have so many packages going through, > that this delay will kill us. > > I'm wondering if any of the possible solutions are available: > > 1) Can I force the first UPDATE connection to stay open, meaning only > a single discovery set, and then fast UPDATEs right after each other > somehow? Would this be part of the driver, or part of our shipping > software? > > 2) Can I force the driver to cut down the amount of discovery it > does? Or cache the discovery? (If I could have it discover only > certain pertinent tables, instead of every table and object in our > entire database, it would be fast enough to do this on every UPDATE > query connection). I tried creating and connecting a specific > database user for this, giving it permissions to only the necessary > tables, but those discovery queries still ran on everything in the > database. > > 3) Are those discovery queries necessary? Or can we turn them off > somehow? > > The only option that seems remotely helpful for this would be the > option of using Cursors, but we select and update single rows at a > time, not many. > > thanks for any help or advice, > > Brev Patterson > Backcountry.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings --------------070402050300080909010005 Content-Type: text/x-vcard; charset=utf8; name="greg.campbell.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="greg.campbell.vcf" begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America;ENG-IT adr;dom:;;2420 Two Notch Road;Lexington;SC;29071 email;internet:greg.campbell@us.michelin.com title:Systems Engineer tel;work:803-951-5561 tel;fax:803-951-5531 x-mozilla-html:FALSE version:2.1 end:vcard --------------070402050300080909010005--