X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0BBF29DCA8D for ; Sun, 12 Feb 2006 03:58:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 42724-01 for ; Sun, 12 Feb 2006 03:58:50 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from uproxy.gmail.com (uproxy.gmail.com [66.249.92.197]) by postgresql.org (Postfix) with ESMTP id 46D809DC8E0 for ; Sun, 12 Feb 2006 03:58:48 -0400 (AST) Received: by uproxy.gmail.com with SMTP id y2so338784uge for ; Sat, 11 Feb 2006 23:58:48 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uouoTkWpCx+vFVc0iopcfWfGg5uKByaGIL+GUwsIs4UkZa8Minxn8MFVShQYCuQ+fRqCCwE39Gaj5DPyd84IjucGNVWsN1XEdoaR3HiYPi0ldf25/BWFLSaql13fX+6pdFmJncqxWCOu2nNVCjEekD7gTZKJs6isHDbUC+jfTUg= Received: by 10.66.186.4 with SMTP id j4mr449875ugf; Sat, 11 Feb 2006 23:58:48 -0800 (PST) Received: by 10.66.221.12 with HTTP; Sat, 11 Feb 2006 23:58:48 -0800 (PST) Message-ID: <1ca1c1410602112358h1e0e9696lff8f172769dc587e@mail.gmail.com> Date: Sat, 11 Feb 2006 23:58:48 -0800 From: Aaron Turner To: "Jim C. Nasby" Subject: Re: 10+hrs vs 15min because of just one index Cc: "Matthew T. O'Connor" , pgsql-performance@postgresql.org In-Reply-To: <20060211212453.GT57845@pervasive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1ca1c1410602100016p2b5fdcc4wbf45612d7efc5fdf@mail.gmail.com> <43ECC9BF.2030107@zeut.net> <1ca1c1410602100924s191e7cddo4bda80d8f8d7cb6d@mail.gmail.com> <20060211212453.GT57845@pervasive.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.786 required=5 tests=[AWL=-0.546, RCVD_IN_BL_SPAMCOP_NET=1.332] X-Spam-Score: 0.786 X-Spam-Level: X-Archive-Number: 200602/132 X-Sequence-Number: 17118 On 2/11/06, Jim C. Nasby wrote: > On Fri, Feb 10, 2006 at 09:24:39AM -0800, Aaron Turner wrote: > > On 2/10/06, Matthew T. O'Connor wrote: > > > Aaron Turner wrote: > > > > Basically, I need some way to optimize PG so that I don't have to drop > > that index every time. > > > > Suggestions? > > I think you'll have a tough time making this faster; or I'm just not > understanding the problem well enough. It's probably time to start > thinking about re-architecting some things in the application so that > you don't have to do this. Well before I go about re-architecting things, it would be good to have a strong understanding of just what is going on. Obviously, the unique index on the char(48) is the killer. What I don't know is: 1) Is this because the column is so long? 2) Is this because PG is not optimized for char(48) (maybe it wants powers of 2? or doesn't like even numbers... I don't know, just throwing it out there) 3) Is there some algorithm I can use to estimate relative UPDATE speed? Ie, if I cut the column length in 1/2 does that make it 50% faster? 4) Does decoding the data (currently base64) and storing the binary data improve the distribution of the index, thereby masking it more efficent? Obviously, one solution would be to store the column to be UPDATED in a seperate joined table. That would cost more disk space, and be more complex, but it would be more efficient for updates (inserts would of course be more expensive since now I have to do two). -- Aaron Turner http://synfin.net/