SQL - Select all rows added yesterday efficiently
I want to select all of the rows added to a table which were added "yesterday" i.e. the day before whenever I choose to run the query.
At the moment my query looks like this:
SELECT row_date (etc)
WHERE row_date >= trunc(sysdate-1)
and row_date < truc(sysdate);
Is there a more efficient (and, hopefully, readabl开发者_StackOverflow社区e) way of achieving this?
Cheers,
Pete
That query doesn't look like it can be optimised to me. You've made it sargable by avoiding wrapping the column itself in any date/time functions.
Do you have an index on row_date?
精彩评论