Re: C-ISAM: COMPRESS with two-parts index
Posted in 1996
Topics: Storage & Space Management
After a few threads offline, I post my question to the mailing list again, in case someone can help me. The initial question was the following: >I have an index composed of a string 'name' (type:CHARTYPE, length:32) >and a long integer 'id' (type:LONGTYPE, length:LONGSIZE). There may be >several identical 'name's, but the combination of 'name' and 'id' ensures >unicity, thus I can (and I do) use flag ISNODUPS. > >My key is: > >struct keydesc the_key = { > ISNODUPS + LCOMPRESS + TCOMPRESS, > 2, > { > { 32, 32, CHARTYPE }, > { 64, LONGSIZE, LONGTYPE } > } >}; > >The question is whether the flag TCOMPRESS can be of some use. If I didn't >have the 'id', the answer would be clearly YES, because the names are >usually less than 32 bytes long. But if compressing technique is applied >after concatenating both indexes, then it would be impossible to have >a series of blanks at the end of the key... Jonathan Leffler wrote: > > To some extent, it works by inference. I don't have the 7.10 manual; > I was looking at the 5.00 version. The examples in there are given > in terms of a single field. However, there is a note saying that it > will work even if the data is not binary. Right. I already thought that it worked whether or not the data is binary, but I'm asking something different. Maybe it's better if I give an example. Let's suppose my data are the following (where I replace each space by a dot, as in the manual) Abbot........................... 0000 Able............................ 7527 Acre............................ 1232 Albert.......................... 4343 Albertson....................... 1234 If the COMPRESS acts on each part individually, then I will get benefit because it could result into (1): ##Abbot ##0000 ##le ##7527 ##cre ##1232 ##lbert ##4343 ##son ##1234 But if it treats the key as a whole, I could instead loose space (2): ##Abbot........................... 0000 ##le............................ 7527 ##cre............................ 1232 ##lbert.......................... 4343 ##son....................... 1234 And I'd better NOT use TCOMPRESS, but only LCOMPRESS, for saving at least one char in each record: #Abbot........................... 0000 #le............................ 7527 #cre............................ 1232 #lbert.......................... 4343 #son....................... 1234 Can someone answer to my question? Does the compressing technique on two-parts keys give something like (1) or something like (2) ? Thanks for any idea ! -- \\\\\\\\ //// (o o) (o o) +----------oOO--(_)--OOo--------------------oOO--(_)--OOo----------+ | mailto:O.Miakinen@frcl.bull.fr Phone: 33 (1) 30 80 70 42 | | http://www-ism.bull.com/ism Fax: 33 (1) 30 80 79 18 | +-------------(_)-(_)--------------------------(_)-(_)-------------+