Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7885E9FA4F9 for ; Thu, 6 Sep 2007 17:24:28 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 09442-01 for ; Thu, 6 Sep 2007 17:24:25 -0300 (ADT) X-Greylist: delayed 00:15:35.834737 by SQLgrey-1.7.5 Received: from mailout11.sul.t-online.com (mailout11.sul.t-online.de [194.25.134.85]) by postgresql.org (Postfix) with ESMTP id 74C1F9FA4BE for ; Thu, 6 Sep 2007 17:24:24 -0300 (ADT) Received: from fwd34.aul.t-online.de by mailout11.aul.t-online.de with smtp id 1ITNeg-0003eQ-00; Thu, 06 Sep 2007 22:08:46 +0200 Received: from [192.168.1.3] (ESpYkgZUgeedXQF1IwZluDnIWQvsqUP+YUsJrM5qRbXEvFMA4Hh6Yz@[87.177.62.30]) by fwd34.aul.t-online.de with esmtp id 1ITNef-0snxLc0; Thu, 6 Sep 2007 22:08:45 +0200 Message-ID: <46E05E4D.3010003@p-dw.com> Date: Thu, 06 Sep 2007 22:08:45 +0200 From: Patric User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Reasonable amount of indices Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-ID: ESpYkgZUgeedXQF1IwZluDnIWQvsqUP+YUsJrM5qRbXEvFMA4Hh6Yz@t-dialin.net X-TOI-MSGID: ab1fb3ff-b799-4d48-8dfd-67a7f8ba9cc3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.395 tagged_above=0 required=5 tests=AWL=-0.207, BAYES_05=-1.11, FH_HAS_XID=2.397, SARE_MILLIONSOF=0.315 X-Spam-Level: * X-Archive-Number: 200709/98 X-Sequence-Number: 26643 Hi, I've a question about amount of indices. I explain my issue based on an example: Table which contains person information, one row per person. There will be lots of SELECTS doing search by special criteria, e.g.: Age, Gender. Now there will be 4 User groups which will select on the table: Group 1) Always doing reads on specific continents. Group 2) Always doing reads in specific country. Group 3) Always doing reads in specific region within a country. Group 4) Always doing reads in specific city. I 'm indexing the the important attributes. Would be about 5 to 6 independent indexes. As there will be millions of rows, quite a lot of hits will be returned, I guess it will generate big bitmaps to calculate the intersection of the indices. Ok to prevent this from happening I'd wanted to create 4 Indexes per attribute, with special predicate, so users which only query for a country don't scan an index which indexed the entire globe: e.g .. CREATE index BlaBla_city on table tblusers(dtage) WHERE dtcity='London'; CREATE index BlaBla_country on table tblusers(dtage) WHERE dtcountry='uk'; CREATE index BlaBla_continent on table tblusers(dtage) WHERE dtcontinent='europe'; etc. SELECT * FROM tblusers WHERE dtcontinent='europe' and age='23' would then postgres lead to use the special index made for europe. Now that I've 4 Indexes. an Insert or update will lead to some more overhead, but which would be ok. My Question now is: Is it wise to do so, and create hundreds or maybe thousands of Indices which partition the table for the selections. Does postgres scale good on the selecton of indices or is the predicate for indices not layed out for such a usage? (PS: Don't want partition with method postgres offers..) thanks in advance, patric