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 6B59D9DC9B0 for ; Tue, 28 Mar 2006 13:30:53 -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 15054-03 for ; Tue, 28 Mar 2006 13:30:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 179FF9DCA33 for ; Tue, 28 Mar 2006 13:30:49 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 778A956431; Tue, 28 Mar 2006 11:30:48 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Tue, 28 Mar 2006 11:30:48 -0600 Date: Tue, 28 Mar 2006 11:30:47 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: simple join uses indexes, very slow Message-ID: <20060328173047.GN75181@pervasive.com> References: <20060327134733.72422d23.gry@ll.mit.edu> <00c901c65283$401f14d0$8300a8c0@tridecap.com> <20060328162908.GB26539@uio.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060328162908.GB26539@uio.no> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060328:pgsql-performance@postgresql.org::7MjWAjws4I/W0lqa:00000 0000000000000000000000006TrV X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/549 X-Sequence-Number: 17986 On Tue, Mar 28, 2006 at 06:29:08PM +0200, Steinar H. Gunderson wrote: > On Tue, Mar 28, 2006 at 10:18:25AM -0600, Dave Dutcher wrote: > >> "parameters_idx" btree (run, opset_num, step_num, opset, > > opset_ver, > >> step, step_ver, name, split, wafers) > >> "parameters_opset_idx" btree (opset, step, name) > >> "parameters_step_idx" btree (step, name) > > Have you tried creating some different indexes on parameters? I don't > > know if it should matter or not, but I would try some indexes like: > > > > (run, opset_num) //Without all the other columns > > (opset_num, run) //Backwards > > (opset_num) > > An index on (A,B,C) can be used for a query on (A,B) or (A), so it doesn't > really matter. It isn't usable for a query on (B), (C) or (B,C), though. (The > index rows will get bigger, of course, so you'll need more I/O if you want to > scan large parts of it, but I guess that's beside the point.) Note that given how statistics currenly work, there are many situations where the planner will refuse to use a multi-column index. This probably won't change until there's some concept of multi-column statistics, at least for multi-column indexes. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461