X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 48B3C3A42FE for ; Wed, 24 Nov 2004 06:51:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41132-02 for ; Wed, 24 Nov 2004 06:51:33 +0000 (GMT) Received: from bluebamboo.ph (unknown [202.175.252.53]) by svr1.postgresql.org (Postfix) with ESMTP id 6A8913A434E for ; Wed, 24 Nov 2004 06:51:30 +0000 (GMT) Received: from irridescens ([192.168.0.180]) by bluebamboo.ph (8.11.6/8.11.6) with ESMTP id iAO6qXi19938 for ; Wed, 24 Nov 2004 14:52:34 +0800 From: "BBI Edwin Punzalan" To: Subject: FW: Index usage Date: Wed, 24 Nov 2004 14:52:07 +0800 Message-ID: <001401c4d1f2$1df5df00$b400a8c0@bluebamboo.ph> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/364 X-Sequence-Number: 9318 Hi everyone, Can anyone please explain postgres' behavior on our index. I did the following query tests on our database: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D db=3D# create index chatlogs_date_idx on chatlogs (date); CREATE db=3D# explain select date from chatlogs where date>=3D'11/23/04'; NOTICE: QUERY PLAN: Index Scan using chatlogs_date_idx on chatlogs (cost=3D0.00..144.11 = rows=3D36 width=3D4) EXPLAIN db=3D# explain select date from chatlogs where date>=3D'10/23/04'; NOTICE: QUERY PLAN: Seq Scan on chatlogs (cost=3D0.00..23938.06 rows=3D253442 width=3D4) EXPLAIN=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Date's datatype is date. Its just odd that I just change the actual = date of search and the index is not being used anymore.