pgsql DATE

From: "Andras Balogh" <abalogh(at)grafx(dot)ro>
To: <pgsql-general(at)postgresql(dot)org>
Subject: pgsql DATE
Date: 2000-04-26 11:49:39
Message-ID: 013001bfaf75$813a0180$0200a8c0@grafx.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I have a question. I don't know what date type to use with postgres.
I have to have a date like '26/04/2000 14:30'. I have created my field as
varchar
and doing all the querying with comparing:
SELECT * FROM pages WHERE date_time ~* '04/2000'
This would return all records from April 2000.

But if in my table are lot of records(150.000) this will be very slow. I
have thought to
create an index but in won't help me because the date_time field is varchar.

So i am looking a date type that would allow me to do the following with one
(or a few) query
(and to be fast too):
-select all records for a given month
-select the count of records where the hour is 14.
-select all the records from the 7th week.
-select count of records where the day of the week is Sunday.
etc.

It is possible to create indexes with date types?

If anybody has some comments please answer me.

Thank You for reading this mail.

Best wishes,

Andras.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2000-04-26 13:53:34 RE: unique row identifier data type exhausted . . .
Previous Message Robert B. Easter 2000-04-26 11:44:16 Re: Is 7.0 ready? -> DBD as well???