Thursday, July 8, 2021

Table or Index Recommendation for reorg

set lines 300 pages 200 col INDEX_NAME for a25 col TABLE_NAME for a35 col INDEX_NAME for a30 SELECT UT.TABLE_NAME, UI.INDEX_NAME, US.BLOCKS AS "TABLE BLOCKS", UI.CLUSTERING_FACTOR AS "INDEX CLUSTERING FACTOR", UT.NUM_ROWS AS "TABLE ROWS", TRUNC((UT.NUM_ROWS/UI.CLUSTERING_FACTOR)/(UT.NUM_ROWS/UT.BLOCKS),2) as CF FROM USER_INDEXES UI, USER_TABLES UT, USER_CONSTRAINTS UC, USER_SEGMENTS US WHERE UI.TABLE_NAME = UT.TABLE_NAME AND UT.TABLE_NAME = UC.TABLE_NAME AND UI.INDEX_NAME = UC.INDEX_NAME AND UT.TABLE_NAME = US.SEGMENT_NAME AND US.SEGMENT_TYPE = 'TABLE' AND UC.CONSTRAINT_TYPE = 'P' AND UI.CLUSTERING_FACTOR > 0 AND UT.BLOCKS > 0 AND UT.NUM_ROWS > 0 AND TRUNC((UT.NUM_ROWS/UI.CLUSTERING_FACTOR)/(UT.NUM_ROWS/UT.BLOCKS),2) < 0.75 and UT.TABLE_NAME not like '%RDF%' ORDER BY CF; set lines 300 pages 200 col INDEX_NAME for a25 col TABLE_NAME for a15 SELECT UT.TABLE_NAME, UI.INDEX_NAME, US.BLOCKS AS "TABLE BLOCKS", UI.CLUSTERING_FACTOR AS "INDEX CLUSTERING FACTOR", UT.NUM_ROWS AS "TABLE ROWS", TRUNC((UT.NUM_ROWS/UI.CLUSTERING_FACTOR)/(UT.NUM_ROWS/UT.BLOCKS),2) CF FROM USER_INDEXES UI, USER_TABLES UT, USER_CONSTRAINTS UC, USER_SEGMENTS US WHERE UI.TABLE_NAME = UT.TABLE_NAME AND UT.TABLE_NAME = UC.TABLE_NAME AND UI.INDEX_NAME = UC.INDEX_NAME AND UT.TABLE_NAME = US.SEGMENT_NAME AND US.SEGMENT_TYPE = 'TABLE' AND UC.CONSTRAINT_TYPE = 'P' AND UT.TABLE_NAME IN ('SALES_DATA','MDP_MATRIX','ITEMS','T_EP_CTO_DATA','T_EP_CTO_MATRIX','GPS_OPPTY_DATA','GPS_OPPTY_DATES','GE_OPPTY','GE_OPPTY_MATRIX') ;

No comments:

Post a Comment

Database Options/Management Packs Usage Reporting for Oracle Databases 11.2 and later (Doc ID 1317265.1)

  Database Options/Management Packs Usage Report You can determine whether an option is currently in use in a database by running options_pa...