Forum OpenACS Q&A: Response to date arithmetic

Collapse
Posted by Stephen van Egmond on
If you have an index on date_created, you're subverting that index with your query. (Unless that part's been optimized since...)

This works for me, and is probably more efficient.

WHERE date_created > date_part('epoch','now') + 3600;

date_part epoch computes the number of seconds (like abstime) and adds 3600. This is a constant, which makes your index useful. I believe the query you gave will force a table scan.