Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2008

    Question Unanswered: Evaluating a Timestamp

    Hi Guys,

    I'm new to PostgreSQL...I'm used to T-SQL which appears to be similar thus far except I'm having difficulty evaluating a timestamp in my WHERE clause.

    I have an indexed field called "update_time" that I'd like to use to filter my data but I'm having some problems.

    It works fine when I give it a literal value
    update_time = '2008-08-21 00:00:01.072'

    However the following does not work (do not return any rows)
    update_time BETWEEN '2008-08-21 00:00:00' AND '2008-08-22 00:00:00'
    update_time <= '2008-08-22 00:00:00'

    I even tried changing the data type before evaluating it but that still doesn't work.
    to_date(update_time, 'YYYY-MM-DD') = '2008-08-21'

    Any help would be appreciated.


  2. #2
    Join Date
    Mar 2008
    Sorry I spoke too soon. Looks like those other methods worked it just took so darn long for the query to run. It is a large database but I'm still surprised that as an indexed field this would be such a problem.

    In the end I narrowed the dataset even further with another indexed field and this seemed to make the queries run much faster.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts