{"id":126,"date":"2023-07-30T02:09:21","date_gmt":"2023-07-30T00:09:21","guid":{"rendered":"http:\/\/130.61.57.200\/?p=126"},"modified":"2023-07-30T02:19:45","modified_gmt":"2023-07-30T00:19:45","slug":"126","status":"publish","type":"post","link":"http:\/\/130.61.57.200\/index.php\/2023\/07\/30\/126\/","title":{"rendered":"Find columns covered in a table&#8217;s indexes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Use the following statement to see all columns covered by indexes on a table:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>with IDX as (\nSelect b.table_owner,a.table_name, a.index_name, a.column_name||&#039; &#039;||decode(a.descend,&#039;DESC&#039;,&#039;DESC&#039;) column_name,column_position,\nb.uniqueness,distinct_keys,blevel,leaf_blocks,num_rows,status,degree,global_stats,partitioned\nFROM dba_ind_columns a,dba_indexes b where b.index_name = a.index_name\nand a.table_name=:1\norder by 1,2,3,5\n)\nSELECT\ntable_owner,table_name,index_name,uniqueness,distinct_keys,blevel,leaf_blocks,num_rows,status,degree,partitioned,global_stats,\nLISTAGG(column_name, &#039;, &#039;)\nWITHIN GROUP (ORDER BY column_position) &quot;COLUMNS&quot;\nFROM IDX\nGROUP BY table_owner,table_name,index_name,uniqueness,distinct_keys,blevel,leaf_blocks,num_rows,status,degree,partitioned,global_stats<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use the following statement to see all columns covered by indexes on a table:<\/p>\n","protected":false},"author":1,"featured_media":106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[35],"class_list":["post-126","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oracle","tag-index"],"blocksy_meta":[],"_links":{"self":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":2,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":129,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/posts\/126\/revisions\/129"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media\/106"}],"wp:attachment":[{"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/130.61.57.200\/index.php\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}