0

I exported the DDL for the EMPLOYEE table in an Oracle DB. What is this index? What columns is this index for?

CREATE UNIQUE INDEX "MY_USER"."SYS_IL0000126968C00005$$" ON "MY_USER"."EMPLOYEE" (
PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "DATA"
PARALLEL (DEGREE 0 INSTANCES 0) ;

This query does not show the above index. How do I query for the above unique index?

select
   TABLE_NAME,
   INDEX_NAME,
   UNIQUENESS,
   NUM_ROWS,
   CONSTRAINT_INDEX,
   OWNER,
   TABLE_OWNER
from
   SYS.ALL_INDEXES;

1 Answer 1

1

That is a LOB index, an internal data structure for accessing LOBs. Such indexes are automatically created for LOB columns, which you have in your table.

Interestingly, a LOB index is not listed in ALL_INDEXES by design, but it is listed in DBA_INDEXES or USER_INDEXES (queried as owner).

You can find the column in [DBA|ALL|USER]_LOBS using the name of the index.

select column_name from all_lobs
where index_name = 'SYS_IL0000126968C00005$$';
4
  • Thank you. I do have a LOB. I have 2 Oracle DBs with the same exact schema. One DB has this LOB index and the other DB does not. Why does the LOB index exist in one but not the other? Does it have to do with the table's data?
    – Nathan
    Commented Jan 5 at 21:55
  • @Nathan Oracle can store LOB inside the table or outside in a dedicated table. See LOB_parameters: ENABLE STORAGE IN ROW: If you enable storage in row, then the LOB value is stored in the row (inline) if its length is less than approximately 4000 bytes minus system control information. This is the default. If you disable storage in row, then the LOB value is stored outside of the row - in this case the index is needed. Commented Jan 6 at 12:17
  • When I generate the DDL, I don't see STORAGE IN ROW or STORAGE IN ROW in the DDL for either DB. In fact, the DDL is identical for the table. What am I missing?
    – Nathan
    Commented Jan 6 at 15:50
  • How did you generate the DDL? It could be set by options. Better check with SELECT TABLE_NAME, COLUMN_NAME, IN_ROW FROM USER_LOBS. Also be aware "enable" means the LOB can be stored inside the table. If the LOB is larger than 4k, then it is stored externally and the index is needed. Commented Jan 18 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.