Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: mk sharma
  Where is mk sharma?
 mumbai
 India
 mk sharma
 To: Luca Moioli
  Where is Luca Moioli?
 Venezia
 Italy
 Luca Moioli
 Tags
Subject: RE: Rushmore for SCAN
Thread ID: 345230 Message ID: 345402 # Views: 36 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 7:27:19 AM         
   


> Dear Simon,
> thank you for suggestion, indeed I just made my benchmark on a testing table of 5,187,157 records (!) and I found best performances with
>
>
> SELECT Table1
> SCAN ALL FOR Field1=m.Val1 AND ALLTRIM(Field2)==m.Val2
> 

>
> Table1 has SET ORDER TO 0 and INDEX ON ALLTRIM(Field2).
> I know putting functions in index expressions (like ALLTRIM) is not recommended, but it was successful in this case, with a SCAN optimized with FOR.
> Sincerely

Have you tried this ?

* Index routine
select yourtable
index on field1+field2 tag field12


*** scan function
local lcKey, lnSeconds
lcKey=m.val1+m.val2
select yourtable
set order to field12
seek m.lcKey
** "scan while" is faster than "scan for " 

lnSeconds=seconds()
scan while Field1=m.Val1 AND Field2=m.Val2
 ** your code
endscan
?seconds()-lnSeconds



Warm Regards,
mk.

ENTIRE THREAD

Rushmore for SCAN Posted by Luca Moioli @ 5/21/2012 7:46:07 AM
RE: Rushmore for SCAN Posted by mk sharma @ 5/21/2012 7:55:07 AM
RE: Rushmore for SCAN Posted by tushar @ 5/21/2012 8:56:21 AM
RE: Rushmore for SCAN Posted by Chuanbing Chen @ 5/22/2012 12:47:40 AM
RE: Rushmore for SCAN Posted by Simon Cropper @ 5/23/2012 3:16:40 AM
RE: Rushmore for SCAN Posted by Luca Moioli @ 5/23/2012 7:06:58 AM
RE: Rushmore for SCAN Posted by mk sharma @ 5/23/2012 7:27:19 AM
RE: Rushmore for SCAN Posted by Luca Moioli @ 5/23/2012 9:30:59 AM
RE: Rushmore for SCAN Posted by mk sharma @ 5/23/2012 9:35:40 AM