pgsql DATE - Mailing list pgsql-general

From Andras Balogh
Subject pgsql DATE
Date
Msg-id 013001bfaf75$813a0180$0200a8c0@grafx.ro
Whole thread Raw
List 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.



pgsql-general by date:

Previous
From: Carsten Huettl
Date:
Subject: pgsql odbc
Next
From: "Robert B. Easter"
Date:
Subject: Re: Is 7.0 ready? -> DBD as well???