Oracle: 索引与 … where a is null

摘自《Troubleshooting Oracle Performance》

假设 a 列上建了一条索引

1. 对于B-树索引

   … where a is null 会导致全表扫描,因为B-树索引不存储NULL值

   若a+b上有联合索引,则

       … where a is null and b = xx 仍会使用索引

2.对于位图索引

      … where a is null 仍然会使用索引,因为位图索引会存储NULL值

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.