the syntax for rebuilding indexes is:
ALTER INDEX indexname REBUILD;
If you want to rebuild all the indexes in your schema then do this:
sql>SPOOL 'REBUILD.SQL'
sql>SELECT 'ALTER INDEX ' || INDEX_NAME || ' REBUILD;' FROM USER_INDEXES;
sql>SPOOL OFF
sql>@REBUILD
hmm rebuild is faster you know? and it achieve the same goal as drop and recreate, also if we use online clause we can rebuild the index online without affecting performance (and index is still valid for users)
Yes you are correct the rebuild can be faster, but will not fix
corruptions.
The performance issue is related to the Rule Based Optimser, and not the performance hit to rebuild the index.
e.g. if multiple indexes can be applied to the WHERE clause, and they all have an equal number of columns specified, only the index
created last will be used.
I have experience performance problems when indexes have been recreated, and the performance has taken a dive. (just one to
be cautious about)
Bookmarks