FAQ

Other comments?
Coming from a math theory background, why are people so intent on separating
date and time? They're both _time_ really... :) One datatype that contains
Just because I'm not interested about time in some cases.
And I don't like to use 'datetime >= _a_day_ and datetime < _next_day_'
Wouldn't have to. "my_date = TO_DATE('_a_day_','Some MMDDYY format')" would
return all dates from _a_day_ regardless of the time part of that datetime.

to get records for a day using indices, because I can't use indices
for "TO_CHAR(datetime, 'DD-MM-YYYY') = _a_day_" (we can't use
functions in multi-column indices - currently, at least).
You could still use the indexes if you built the where clause using the datetime
field instead of the char string returned by the function. Would only really
need the function in the select clause.

SELECT TO_CHAR(my_date, 'DD-MM-YYYY')
FROM foo
WHERE my_date = TO_DATE('_a_day_','SomeFmtString');

should still use an index on my_date. The value returned by the TO_DATE does
not change, it's only needed to tell the db to convert _a_day_ to a datetime.


darrenk

------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJul 1, '97 at 2:01p
activeJul 1, '97 at 2:01p
posts1
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Darren King: 1 post

People

Translate

site design / logo © 2021 Grokbase