Index for nullable column

前端 未结 3 531
攒了一身酷
攒了一身酷 2020-12-15 22:52

I have an index on a nullable column and I want to select all it\'s values like this:

SELECT e.ename 
FROM   emp e;

In the explain plan I s

3条回答
  •  死守一世寂寞
    2020-12-15 23:22

    I am not sure the first query is pertinent in terms of index usage, at least the second could.

    Anyway, while it is true that you cannot index a column containing a null value, there are ways to do it like for example:

    create index MY_INDEX on emp(ename, 1);
    

    notice the , 1) at the end which does the trick.

提交回复
热议问题