Re: Create index on the year of a date column - Mailing list pgsql-general

From Ron Johnson
Subject Re: Create index on the year of a date column
Date
Msg-id 1054895641.18124.46.camel@haggis
Whole thread Raw
In response to Create index on the year of a date column  ("Nick Barr" <nick.barr@webbased.co.uk>)
List pgsql-general
On Thu, 2003-06-05 at 11:38, Nick Barr wrote:
> Hi,
>
> I am trying to create an index on the year of a date field, to speed up
> some queries. Table structure is as follows

If, for example, you want all records where item_created_start_date
in calendar year 2001, why not create the index on i_c_s_d and say
  WHERE item_created_start_date between '2001-01-01' and '2001-12-31'


--
+-----------------------------------------------------------+
| Ron Johnson, Jr.     Home: ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson |
|                                                           |
| Regarding war zones: "There's nothing sacrosanct about a  |
| hotel with a bunch of journalists in it."                 |
|     Marine Lt. Gen. Bernard E. Trainor (Retired)          |
+-----------------------------------------------------------+


pgsql-general by date:

Previous
From: Jon Earle
Date:
Subject: Re: Nulls get converted to 0 problem
Next
From: Richard Huxton
Date:
Subject: Re: EXTERN JOIN with WHEN query