I was looking up on index on a table that I have and reading in a book about index and ran this query to check the index on my shipment table which is main table used where I work. By the way, I am using Oracle 8i database. Here it is:
PHP Code:
select table_name, index_name, column_name, column_position from dba_ind_columns
where table_name = 'SHIPMENT'
AND TABLE_OWNER = 'ORACLE'
order by column_name, index_name, column_position
What I read in the book briefly, that if you have two index on the same column on the same table, it can result slow down since Oracle has two choose from those two index or somthing like that.
In my example, I have two indexes on ACT_DELIVERY_DATE AND ACT_LOAD_DATE, which in my opinion is not good for the table. Can someone with a little bit of knowledge on index can reinforce on this? Thanks.
Last edited by tamilselvan; 01-28-2005 at 10:40 AM.
select table_name, index_name, column_name, column_position from dba_ind_columns
where table_name = 'SHIPMENT'
AND TABLE_OWNER = 'ORACLE'
order by index_name, column_position
... and surround it with the code tags. [ code ] at the beginning and [ /code ] at the end (take out the spaces separating the brackets from the rest)
ACT_DELIVERY_DATE and ACT_LOAD_DATE are indexed alone and in SECOND position in the composite indexes - so you have no redundancy. (If they had been in first position in the composite indexes, then the index on theses fields alone would have been superfluous.) You will probably find a script on this site for identifying redundant indexes.
Of course, it's possible that some of the indexes are never actually used - but that is a different and MUCH HARDER question.
The overhead in deciding which index to use is unlikely to be noticible. The real overhead from excessive indexes is the extra time required for maintaining the indexes when changes are made to the table, and the space occupied.
Thanks for your reply and answering my question. After running the query as per your request I can also see the difference better. Thanks for the script too. This is a great forum.