Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id BFC1B9FB676 for ; Fri, 12 Oct 2007 10:06:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 31169-05 for ; Fri, 12 Oct 2007 10:06:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by postgresql.org (Postfix) with ESMTP id 0A3A19FBD76 for ; Fri, 12 Oct 2007 10:02:35 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id f5so716223nfh for ; Fri, 12 Oct 2007 06:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=5bIfTcBoLEPu6tuYkLz7LWlMPYWZIp/p/RYJjwQ79+k=; b=sxB2ca7OMlcR/7gT7j7lzMd5ejT5UfnHOjxUQY6LNFqERdQGItkTqXjPvlMNPWTLwJugV7z8jttDFtzaM8qyap9Bhzuw/+Hfl5D9sYuxMGGHXHu0F75uPWmz84vQJuEiql3XeboumM3J5daQoHof/E9bgI4ZW1OWhu5zX/mDSEM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CiCL8C2a3mgiE+SWMf7b1uLBgTxa6jc7mza6F6Zfn3ax/V9i1YeN+zZRyLlzc7zNoer5QbppNTa9DylP0b5g9lUaoIk9WPcuXMMRjPPEFd5uEbZyUD7gSBwOvEZr3XH9vqZVoh5tBz6VvAKI6DqHJFwtSzXeHgdRP4pYaxIi+A4= Received: by 10.78.193.19 with SMTP id q19mr2241155huf.1192194152248; Fri, 12 Oct 2007 06:02:32 -0700 (PDT) Received: by 10.78.33.6 with HTTP; Fri, 12 Oct 2007 06:02:32 -0700 (PDT) Message-ID: Date: Fri, 12 Oct 2007 09:02:32 -0400 From: "Merlin Moncure" To: theo@flame.co.za Subject: Re: Performance problems with prepared statements Cc: pgsql-performance@postgresql.org In-Reply-To: <1192174502.2470.9.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1192027540.2495.3.camel@localhost.localdomain> <470CE918.4060608@dalibo.com> <1192044840.2549.21.camel@fedmac> <1192174502.2470.9.camel@localhost.localdomain> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/146 X-Sequence-Number: 27168 On 10/12/07, Theo Kramer wrote: > On Thu, 2007-10-11 at 16:04 -0400, Merlin Moncure wrote: > > is this a converted cobol app? > > :) - on the right track - it is a conversion from an isam based package > where I have changed the backed to PostgreSQL. Unfortunately there is > way too much legacy design and application code to change things at a > higher level. fwiw, I converted a pretty large cobol app (acucobol) to postgresql backend translating queries on the fly. if this is a fresh effort, you definately want to use the row-wise comparison feature of 8.2. not only is it much simpler, it's much faster. with some clever caching strategies i was able to get postgresql performance to exceed the isam backend. btw, I used execprepared for virtually the entire system. example read next: select * from foo where (a,b,c) > (a1,b1,c1) order by a,b,c limit 25; example read previous: select * from foo where (a,b,c) < (a1,b1,c1) order by a desc, b desc, c desc limit 25; etc. this will use complete index for a,b,c and is much cleaner to prepare, and parse for the planner (the best you can get with standard tactics is to get backend to use index on a). Another big tip i can give you (also 8.2) is to check into advisory locks for isam style pessimistic locking. With some thin wrappers you can generate full row and table locking which is quite powerful. merlin