Re: Index on timestamp to date field

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Patrick Hatcher <PHatcher(at)macys(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Index on timestamp to date field
Date: 2003-10-14 12:53:36
Message-ID: Pine.BSF.4.44.0310140851410.1994-100000@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 13 Oct 2003, Patrick Hatcher wrote:

> I have a timestamp field where I find I'm doing a lot of searching by date
> (YYYY-MM-DD) or using this field as a match to another table that has a
> date format. I wanted to create an index on the timestamp field using a
> date format. Is this possible? I tried:
> CREATE INDEX test_2 ON table1 USING btree to_char(field2, 'MM-DD-YYYY');
> but I get an error message error at or new to_char
>
> TIA
>

So you don't want a oh. lets call it a "real index" on the timestamp
field?

create index ts_index on mytable(mytimestamp);

Or can you not change the way the dates are input?

Or is the "mytimestamp" field a varchar containing a date string?

--
Jeff Trout <jeff(at)jefftrout(dot)com>
http://www.jefftrout.com/
http://www.stuarthamm.net/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2003-10-14 14:07:12 Re: Temporary tables and miscellaneous schemas
Previous Message Harry Broomhall 2003-10-14 12:48:11 Re: Performance weirdness with/without vacuum analyze