X-Original-To: pgsql-general-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3F5ED9FA42B for ; Fri, 16 Jun 2006 12:28:08 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 51193-01 for ; Fri, 16 Jun 2006 12:27:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 778929FA5C3 for ; Fri, 16 Jun 2006 12:27:59 -0300 (ADT) Received: (qmail 12719 invoked by uid 500); 16 Jun 2006 15:31:32 -0000 Date: Fri, 16 Jun 2006 10:31:32 -0500 From: Bruno Wolff III To: Benjamin Arai Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org Subject: Re: Question about clustering multiple columns Message-ID: <20060616153132.GA9056@wolff.to> Mail-Followup-To: Bruno Wolff III , Benjamin Arai , pgsql-general@postgresql.org, pgsql-performance@postgresql.org References: <002e01c68f03$05f00e10$6501a8c0@uni> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002e01c68f03$05f00e10$6501a8c0@uni> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/676 X-Sequence-Number: 97048 On Tue, Jun 13, 2006 at 09:04:15 -0700, Benjamin Arai wrote: > Hi, > > I have a database where there are three columns (name,date,data). The > queries are almost always something like SELECT date,data FROM table WHERE > name=blah AND date > 1/1/2005 AND date < 1/1/2006;. I currently have three > B-tree indexes, one for each of the columns. Is clustering on date index > going to be what I want, or do I need a index that contains both name and > date? I would expect that clustering on the name would be better for the above query. You probably want an index on name and date combined.