Optimization of the sets / find

Olivier vidal_olivier at yahoo.fr
Fri Feb 18 08:47:16 CST 2005


Hi Ruslan,

>> - > Set2=fd.findContains ("PA", Set1)
>> This method is NOT faster than set2=fd.findcontains ("PA")... why ?
>
> This method will be faster ONLY if you do not have index on a field.
> Then you really reduce the number of records for iteration.
>
>
> But when exists index this Set1 do not help. We still need scan each
> distinct value in the index. And this is constants time.
>
> Hmm, of course if Set1 contains e.g. One record but index has 100,000
> distinct values then really it is better not use index. So really 
> exists
> some condition. Please put this into mantis, and copy this my text 
> there.
>
>

yes, I make tests :

- 100 000 records

1- WITH INDEXS :

In every typed letter, search makes approximately 7 ticks.

2- WITHOUT INDEXS :

with, for every typed letter :
>> set2=fd.findcontains ("PA")
the searchs makes approximately 95 ticks (thus for each typed letter)

with :
>> Set2=fd.findContains ("PA", Set1)   //(Set1= prev set)

6 examples :

first typed letter : 93 ticks
2° typed letter : 77 ticks (in set of 85 570 records)
3° typed letter : 7 ticks (in set of 7 008 records)
4° typed letter : 1 ticks (in set of 357 records)

first typed letter : 93 ticks
2° typed letter : 49 ticks (in set of 54 549 records)
3° typed letter : 5 ticks (in set of 6 021 records)
4° typed letter : 0 ticks (in set of 336 records)

first typed letter : 92 ticks
2° typed letter : 77 ticks (in set of 85 570 records)
3° typed letter : 4 ticks (in set of 4 041 records)
4° typed letter : 3 ticks (in set of 2 949 records)

first typed letter : 93 ticks
2° typed letter : 60 ticks (in set of 68 391 records)
3° typed letter : 8 ticks (in set of 8 529 records)
4° typed letter : 1 ticks (in set of 1 344 records)

first typed letter : 94 ticks
2° typed letter : 43 ticks (in set of 46 775 records)
3° typed letter : 5 ticks (in set of 4 645 records)
4° typed letter : 1 ticks (in set of 576 records)

first typed letter : 95 ticks
2° typed letter : 27 ticks (in set of 30 647 records)
3° typed letter : 8 ticks (in set of 8 614 records)
4° typed letter : 5 ticks (in set of 5 754 records)

In this example, as soon as the set makes less than 6 or 7 000 records, 
it is more interesting to make a search without index.

Thus, effectively, if with condition, we could use or not use the index 
for the search, that would be very powerful.

I puts it in the mantis.

thank you

olivier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2571 bytes
Desc: not available
Url : http://lists.macserve.net/pipermail/valentina-beta/attachments/20050218/adb66746/attachment.bin


More information about the Valentina-beta mailing list