Index fragmentation in LMT
Hi All,
In our database all the index and data tablespaces are LMT tablespaces. We are aware that the LMT tablespaces doesnt have fragmentation. But I have read some article, stating that the index objects will have holes while there are frequent deletions in data, and hence they are fragmented and the only way to correct them is to rebuild the indexes. Even the indexes are in the LMT this will happen.
So just correct me whether my understanding is correct or not.
As my indexes are in LMT, so if I rebuild them, will there be any use out of that?
Re: Index fragmentation in LMT
Hi,
LMT called as Locally Managed Tablespace is a new feature introduced from Oracle 8i.Basically prior to 8i the only tablespace that you can create was Dictionary managed which meant that any allocation or de-allocation of extents will be tracked by the data dictionary.In 8i the LMT will track the extent allocation and de-allocation by itself.Which means that in every datafile of the LMT tablespace ,there is a bitmap which keeps information about the extents in that datafile.So whenever an extent is allocated or de-allocated ,the bit in the bitmap will reflect the changes,so due to this the recursive calls on the data-dictionary is reduced.Also since LMT keeps track of the extents,the coalesing is done automatically.
Now regarding your question that your indexes and data is in LMT,indexes always have a high degree of fragmentation when your data is frequently deleted or updated or inserted in the table.So accordingly indexes will also take the changes.Whenever there are high deletions on the tables,the indexes will also have the effect of deletions because of which they become fragmented.
Eventhough u keep the indexes in the dictionary managed or LMT,the fragmentation of indexes will happen ,so you must rebuild your indexes when it becomes more fragmented.The kind of tablespace use to house the indexes will have a very little impact on the performance.
Regards,
Rohit Nirkhe,Oracle/Apps DBA,OCP 8i
[email protected]
Re: Index fragmentation in LMT
Quote:
Originally posted by V6163
Hi All,
In our database all the index and data tablespaces are LMT tablespaces. We are aware that the LMT tablespaces doesnt have fragmentation. But I have read some article, stating that the index objects will have holes while there are frequent deletions in data, and hence they are fragmented and the only way to correct them is to rebuild the indexes. Even the indexes are in the LMT this will happen.
So just correct me whether my understanding is correct or not.
As my indexes are in LMT, so if I rebuild them, will there be any use out of that?
Get us the result of this query....and higlight the tablespace where ur Index resides....if the tablespace has reached fragmentation above 90% then u may need to rebuild..............
This query gives all the tablspaces which are fragmented mor than 90%.....
Code:
rem =====================================================
clear screen
SET ECHO OFF
SET PAGESIZE 1000
SET FEEDBACK OFF
SET LINESIZE 1000
COLUMN Tablespace FORMAT A15 HEADING 'Tablespace Name'
COLUMN Total_Size FORMAT 9,999 HEADING 'Total Space(GB)'
COLUMN Free_Space FORMAT 9,999 HEADING 'Free Space(GB)'
COLUMN Percentage FORMAT 90.0 HEADING '% Used'
COLUMN decode FORMAT A14 HEADING '(Space Gauge)'
COLUMN fragdec FORMAT A14 HEADING '(Frag Gauge)'
COLUMN percfrag FORMAT 90.0 HEADING '% Frag'
COLUMN frags FORMAT 9,999 HEADING 'Frags'
COLUMN bigchunk FORMAT 9,999 HEADING 'Big Chunk(GB)'
COLUMN gap HEADING ' '
COLUMN data_files FORMAT 99 HEADING 'Data Files'
TTITLE 'Tablespace Analysis - Space Management and Fragmentation'
select free.tablespace_name Tablespace, tot.total Total_Size,free.free Free_Space,
100 - ((free.free / tot.total) * 100) Percentage,
decode
((ceil(10-(free.free / tot.total) * 10)),
0,'| .......... |',
1,'| *......... |',
2,'| **........ |',
3,'| ***....... |',
4,'| ****...... |',
5,'| *****..... |',
6,'| ******.... |',
7,'| *******... |',
8,'| ********.. |',
9,'| *********. |',
10,'| **danger** |') decode,
bigchunk, '|' gap, data_files, frags, percfrag,
decode ((ceil(percfrag / 10)) ,
0,'| .......... |',
1,'| *......... |',
2,'| **........ |',
3,'| ***....... |',
4,'| ****...... |',
5,'| *****..... |',
6,'| ******.... |',
7,'| *******... |',
8,'| ********.. |',
9,'| *********. |',
10,'| **danger** |') fragdec
from
(
select tablespace_name, ceil(sum(bytes) / (1048576*1024)) total, count(*) data_files
from sys.dba_data_files
group by tablespace_name
) tot,
(
select tablespace_name, ceil(sum(bytes) / (1048576*1024)) Free,
ceil(max(bytes) / (1048576*1024)) bigchunk, count(*) frags,
100 - (max(bytes) / sum(bytes)) * 100 percfrag
from sys.dba_free_space
group by tablespace_name
) free
where free.tablespace_name = tot.tablespace_name and
percfrag>90
order by free.tablespace_name,Percentage, percfrag
/
CLEAR COLUMNS
TTITLE OFF
BTITLE OFF
SET FEEDBACK ON
SET PAGES 24
CLEAR BREAKS
Abhay.
Re: Re: Index fragmentation in LMT
Quote:
Originally posted by abhaysk
Get us the result of this query....and higlight the tablespace where ur Index resides....if the tablespace has reached fragmentation above 90% then u may need to rebuild..............
This query gives all the tablspaces which are fragmented mor than 90%.....
Abhay, haven't you noticed that the original question (and even the subject of the thread) explicitely states that we are talking about LMT. So your query is totaly useless... The fragmentation that is reported by your query is irrelevant for localy managed tablespaces.
Re: Re: Re: Index fragmentation in LMT
Quote:
Originally posted by jmodic
Abhay, haven't you noticed that the original question (and even the subject of the thread) explicitely states that we are talking about LMT. So your query is totaly useless... The fragmentation that is reported by your query is irrelevant for localy managed tablespaces.
Jmodic:
I am wrong....i was totaly out of my mind....didnt go thru message thourghly......
Cud u highlight on how abt knowing Tablespsace fragmentation for LMT managed tablespaces...
Abhay.