X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7CF77D1B531 for ; Wed, 15 Oct 2003 20:43:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 32008-04 for ; Wed, 15 Oct 2003 17:42:31 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 09627D1B502 for ; Wed, 15 Oct 2003 17:42:29 -0300 (ADT) 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 h9FKgSNu013915 for ; Wed, 15 Oct 2003 20:42:28 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id h9FKPF0i011328 for pgsql-sql@postgresql.org; Wed, 15 Oct 2003 20:25:15 GMT From: teknokrat X-Newsgroups: comp.databases.postgresql.sql Subject: Re: indexing timestamp fields Date: Wed, 15 Oct 2003 21:25:17 +0100 Organization: Hub.Org Networking Services Lines: 20 Message-ID: References: <60wub6wjxf.fsf@dev6.int.libertyrms.info> Reply-To: teknokrat@yahoo.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0+) Gecko/20020518 X-Accept-Language: en, en-us, ko In-Reply-To: <60wub6wjxf.fsf@dev6.int.libertyrms.info> To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/190 X-Sequence-Number: 15590 Christopher Browne wrote: > teknokrat writes: > >>Is it a good idea to index timestamp fields? what about date fields in >>general? > > > If you need to order by a timestamp, then it can be worthwhile. > > If that timestamp can be null, and is rarely populated, then you might > get a _big_ benefit from creating a partial index as with: > > create index by_some_date on my_table(some_date) where some_date is > not null; I have a lot of queries of the " where timestamp < some date " type and was wondering if an index would improve performance. None of the timestamps are null and they are always populated