Re: Help calculating extents from esql-c
Posted in 1995
As to your initial question, I do not think that you will be able to calculate the number of extents. As far as I am aware tbcheck is the only way that you can calculate the number of extents on a table. If you look at the extent sizes for a table, as shown an a tbcheck, you will notice that the actual first extent size on disk may not be the same as the first extent size that was set up when the table was created. This also applies to the next extent size. The reason for this is that On-Line will allocate the setup first extent size on creation of the table. When that extent is full and a new extent size needs to be created, On-Line gets the next extent size and looks at where it is going to put this onto the disk. If this next extent is going to be put on contiguous sectors on the disk to the last extent, On-Line extends the previous extent rather than adding another extent. Therefore if your table is the only table in a dbspace, it will only ever have one extent, unless your table exceeds your dbspace size and a new chunk is added. If the number of extents for your table is growing too large, (>8 I think) On-Line will automatically increase the size of the next extent value. (This statement may be shot down because I am not 100% on this one.) As far as creating a cluster index on your table, this will generally de-fragment your table. However, if your free space on your dbspace is fragmented, your re-created table could be split between the free spaces. If you want to guarantee that your re-created table is in one extent, calculate the size of your table and indexes and created a duplicate table with the first extent size as this calculated size plus a percentage. Copy all the data from you original table to the new table and rename your tables so that old becomes new and vice versa. Your new table should now be in one extent with room to grow. Be careful if you ever reference the rowids in this table because this process and creating a cluster index will change them. HTH --------------------------------------------- All opinions are my own Neil Stevenson nmsteven@eukcumbpo1.unitedkingdom.attgis.com Voice: +44 1236 851218 Fax: +44 1236 457459 ---------------------------------------------