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 98F003A3C51 for ; Fri, 5 Nov 2004 12:54:00 +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 91206-03 for ; Fri, 5 Nov 2004 12:53:56 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 456703A3C3E for ; Fri, 5 Nov 2004 12:53:58 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id iA5CrtJ7092419 for ; Fri, 5 Nov 2004 12:53:55 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id iA5Co20Y091199 for pgsql-performance@postgresql.org; Fri, 5 Nov 2004 12:50:02 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Checking = with timestamp field is slow Date: Fri, 05 Nov 2004 07:47:54 -0500 Organization: cbbrowne Computing Inc Lines: 21 Message-ID: References: <2989532e0411042316566b35f4@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:s5VTkhBAHnD6cjO0VHLAIcYbZyU= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Level: * X-Archive-Number: 200411/93 X-Sequence-Number: 9047 After a long battle with technology, antonypaul24@gmail.com (Antony Paul), an earthling, wrote: > Hi all, > I have a table which have more than 200000 records. I need to get > the records which matches like this > > where today::date = '2004-11-05'; > > This is the only condition in the query. There is a btree index on the > column today. > Is there any way to optimise it. How about changing the criterion to: where today between '2004-11-05' and '2004-11-06'; That ought to make use of the index on "today". -- "cbbrowne","@","ntlug.org" http://www.ntlug.org/~cbbrowne/sgml.html "People need to quit pretending they can invent THE interface and walk away from it, like some Deist fantasy." -- Michael Peck