Indexing in Oracle, Fragmentation
I just uploaded my slides from Collaborate 2017 to Slideshare, but also, the findings missing from my slide deck I used for Oak Table World on War of the Indices- Oracle and SQL Server. Feel free to download them here.
As I tested out Oracle vs. SQL Server Index performance, I ran across this great script to check for fragmentation from Franck Pachot. You’ll need to simply update the script to declare the table and index name or simply edit the script as is, adding those two values correctly before running it.
The outcome when run against my ugly index in the testing of the good, the bad and the ugly, was fun, to say the least:
SQL> @index_frag.sql; C1 -> C1 rows/block bytes/block %free space blocks free ---------- -- ---------- ---------- ----------- ----------- ---------- ----- 30041 -> 130221 35 560 93 2851 oooo 130256 -> 230433 35 560 93 2851 oooo 230468 -> 330654 35 560 93 2851 oooo 330689 -> 430874 35 560 93 2851 oooo 430909 -> 531073 35 560 93 2851 oooo 531108 -> 631264 35 560 93 2850 oooo 631299 -> 731429 35 560 93 2850 oooo 731464 -> 831547 35 560 93 2850 oooo 831583 -> 931711 35 560 93 2850 oooo 931746 -> 1030047 34 560 93 2850 oooo
If you have just one or a couple indexes that you want to perform some deep analysis to view fragmentation, Franck’s script does an awesome job.
Just my share for the day…. 🙂
Pingback: Priority Support Infogram, 07 April 2017 - GIN Personal Web Site