Index Not Selected When Index Column Is NVARCHAR2 And First 16 Characters Are Identical
(Doc ID 2741162.1)
Last updated on MARCH 31, 2021
Oracle Database - Enterprise Edition - Version 184.108.40.206 to 220.127.116.11 [Release 11.2]
Information in this document applies to any platform.
- Customer find that optimizer generated bad SQL plan with "TABLE ACCESS FULL" rather than "INDEX UNIQUE SCAN".
- In the SQL, the column of WHERE condition is NVARCHAR2(30), and the first 16 characters are identical though the whole value is unique.
- The NLS_NCHAR_CHARACTERSET is AL16UTF16.
- Histogram has been gathered on this column.
- After change the column from NVARCHAR2(30) to VARCHAR2(30), optimizer generated good SQL plan with "INDEX UNIQUE SCAN".
- This problem can be reproduced by following simple test case:
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.