4D v14.3

Get table fragmentation

Home

 
4D v14.3
Get table fragmentation

Get table fragmentation 


 

Get table fragmentation ( aTable ) -> Function result 
Parameter Type   Description
aTable  Table in Table for which to get the fragmentation rate
Function result  Real in Percentage of fragmentation

The Get table fragmentation command returns the percentage of logical fragmentation for the records of the table designated by the aTable parameter

The rate of logical fragmentation of the records indicates whether the records are stored in an ordered manner in the data file. If the fragmentation becomes too high, this can considerably slow down sorts and sequential searches on the table. A fragmentation percentage of 0 corresponds to no fragmentation. Beyond a rate of 20%, it may be useful to compact the data file.

Example  

This maintenance method lets you request the compacting of the data file in the case where there is considerable fragmentation in at least one table of the database:

 ToBeCompacted:=False
 For($i ;1;Get last table number)
    If(Is table number valid($i))
       If(Get table fragmentation(Table($i)->)>20)
          ToBeCompacted:=True
       End if
    End if
 End for
 If(ToBeCompacted)
  // Places a marker requesting compacting
 End if

 
PROPERTIES 

Product: 4D
Theme: 4D Environment
Number: 1127

 
HISTORY 

Created: 4D v12

 
SEE ALSO 

Compact data file

 
TAGS 

Fragmentation

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)