开发者

index for `where wakeup_time < sysdate`

For most records this field开发者_运维知识库 is null. I need to wake up only some records.

The table is very big and I want to know which records to wake up. I don't want database to seek every row. Could you show me your idea?


Create an ordinary index on just (WAKEUP_TIME). Only the rows where WAKEUP_TIME is not null will be stored in the index. When WAKEUP_TIME is updated to NULL, the entry will be removed from the index, so the index will be the most efficient way of finding all the rows that match your predicate.


Why don't you just create an index on wakeup_time? Also, you may fill it with a far away date by default, like 3000-01-01.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜