开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜