Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9B57764FDEF for ; Wed, 12 Nov 2008 16:06:18 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 01053-01 for ; Wed, 12 Nov 2008 16:06:10 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id E931564FD9B for ; Wed, 12 Nov 2008 16:06:10 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.1/8.14.1) with ESMTP id mACK68Ks069625 for ; Wed, 12 Nov 2008 16:06:08 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.1/8.14.1/Submit) id mACJwBEl062079 for pgsql-performance@postgresql.org; Wed, 12 Nov 2008 15:58:11 -0400 (AST) (envelope-from news) From: "Andrus" X-Newsgroups: pgsql.performance Subject: Re: Increasing select max(datecol) from bilkaib wheredatecol<=date'2008-11-01' and (cr='00' or db='00') speed Date: Wed, 12 Nov 2008 21:57:06 +0200 Organization: Hub.Org Networking Services Lines: 16 Message-ID: References: <20081112193918.GA7752@depesz.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=original Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org In-Reply-To: <20081112193918.GA7752@depesz.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18049 To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=STOX_REPLY_TYPE=0.001 X-Spam-Level: X-Archive-Number: 200811/107 X-Sequence-Number: 31838 Depesz, > do you always have this: "(cr='00' or db='00')"? or do the values (00) > change? > if they don't change, or *most* of the queries have "(cr='00' or > db='00')", than the biggest time difference you will get after creating > this index: > create index test on bilkaib (kuupaev) where cr='00' or db='00'; I have always cr='00' or db='00' clause. Separate values are never tested. I changed by queries back to old values and created this single index. This seems to be even better that Vladimir suggestion. Thank you very much. Andrus.