Re: Performance and key lenght
Posted in 1998
Albert wisse wrote: > > What is the speed difference on selects like select * from table where > key = 'ksks......kjljf;qlfk" when the key on which selected is of > size: > > a) varchar[16] > b) varchar[32] > c) varchar[64] > > The key is indexed so the select uses the index to find the table > row(s). > > Does it depens on the word size of the CPU and/or how many registers a > CPU has. > I am using a SUN Enterprise server with four UltraSparc II CPU's. Like most string key searches the average performance depends on the average number of characters before a matching key is identified (average match length) rather than the length of the column. If the average matchlength is <16 for all of these key lengths (16,32,64) then the search performance will be identical. If the average match length for the 64 char key is 50 then the 32 and 16 byte keys will perform better. You can probably get a reasonable guestimate of the match length, and at least establish an upper limit for the average match length by determining the average length of the key values being stored. Average match length will equal average key length if all keys are identical except for the last character (in which pathological case you should just make that character the key anyway) normally average match length must be less than average key length. Art S. Kagel