X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 50DC39FA634 for ; Thu, 8 Jun 2006 15:55:20 -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 13355-07 for ; Thu, 8 Jun 2006 15:55:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id C49DC9FA1A4 for ; Thu, 8 Jun 2006 15:55:10 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id BCFB731968; Thu, 8 Jun 2006 20:55:09 +0200 (MET DST) From: "Andrus" X-Newsgroups: pgsql.performance Subject: Why date index is not used Date: Thu, 8 Jun 2006 21:53:17 +0300 Organization: Hub.Org Networking Services Lines: 31 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/97 X-Sequence-Number: 19454 Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query ? How to speed this query up ? explain analyze select * from makse order by kuupaev desc, kellaaeg desc limit 100 "Limit (cost=62907.94..62908.19 rows=100 width=876) (actual time=33699.551..33701.001 rows=100 loops=1)" " -> Sort (cost=62907.94..63040.49 rows=53022 width=876) (actual time=33699.534..33700.129 rows=100 loops=1)" " Sort Key: kuupaev, kellaaeg" " -> Seq Scan on makse (cost=0.00..2717.22 rows=53022 width=876) (actual time=0.020..308.502 rows=53028 loops=1)" "Total runtime: 37857.177 ms" CREATE TABLE makse( kuupaev date, kellaaeg char(6) NOT NULL DEFAULT ''::bpchar, guid char(36) NOT NULL, CONSTRAINT makse_pkey PRIMARY KEY (guid) ) CREATE INDEX makse_kuupaev_idx ON makse USING btree (kuupaev); Andrus.