Re: free space in .dat files
Posted in 1995
OK, I'm flatterable... >From: Sally Woolrich <Sally@excelsis.demon.co.uk> >Date: Wed, 21 Jun 95 10:45:56 GMT >X-Informix-List-Id: <news.14832> > >In article <3s2m06$4c3@rcogate.rco.qc.ca> cat@tecsys.com "Catalin Badea" writes: > >> Charles Francis (ancrcs4!cfrancis@ancrcs4.attmail.com) wrote: >> >> : Using (rowsize + 4) * nrows may not come close to estimating the >> : size of an Informix SE data file. >> >> : Unless the columns of the rows have been defined as not allowing >> : NULLs every row stored may be a different length. ><big snip> >> The space required to store each row in the .dat file is the rowsize + 1. >> (At least from C-ISAM version 2.0 to Standard Engine 7.1). > >I think we need a little help form Informix here! My understanding is that >C-ISAM files are FIXED FORMAT e.g. all rows are stored as the same length. It depends on whether you have one of the versions which supports variable length records as required by the X/Open definition of C-ISAM... If you do (5.0x and later for sure; I don't remember whether that change was in 4.x), then the rows may vary in size. However, the variable portion of the record is stored in the .idx file, not the .dat file, for a variety of sound reasons, not least of which is that the row location algorithms rely on the rows being of a fixed size. For all purposes, the records in the .dat file are fixed size, and for all practical purposes, the records supported by C-ISAM are fixed size. >I may be getting confused with the Indexes where the 4 bytes are the 'hidden' >index on the rowid. Certainly there must be an 'extra' per row as there >is a deletion flag somewhere in all this. Each data row consists of the data plus one byte which is either '\\0' meaning deleted or '\\n' meaning current. >Jonathan Leffler to the rescue? Does he have an ACCURATE algorithm for >the '.dat' files at least? Does one, indeed, exist?! :-) Err... what's the question? How big is a maximally compressed (or minimum size) .dat file? Given N rows and B bytes of data per row, the size of the .dat file is (B+1)*N bytes. Space occupied by deleted rows is never .released to the file system; it is reused in due course by C-ISAM. How big is a .idx file? That's real nasty and not deterministic -- it depends in part on the order of insertions and deletions. Ugh. The approximations quoted in the manuals etc are approximations, but reasonably valid. Don't forget that keys can be compressed and all sorts of other complicating factors. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>