Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Vivek Deodhar
  Where is Vivek Deodhar?
 SANGLI
 India
 Vivek Deodhar
 To: Khurram Tahir
  Where is Khurram Tahir?
 Karachi
 Pakistan
 Khurram Tahir
 Tags
Subject: RE: Seek Vs Select Sql in Speed
Thread ID: 395754 Message ID: 395755 # Views: 62 # Ratings: 1
Version: Visual FoxPro 9 Category: Projects and Design
Date: Saturday, January 18, 2014 2:45:54 PM         
   


> Table1 has more then 70000 Records and accessing on multiuser environment and on Lan Select command performing Slow Speed
>
>
SELECT * FROM Table1 WHERE Fld1 = lcA AND Fld2 = lcB AND Fld3 <> lnC INTO CURSOR TcCnt
> 

>
> 1st) Now Created join index on above fields also
>
>
INDEX ON Fld1+Fld2+STR(Fld3,6)	TAG FLD_123
> 

> How can use Seek or IndexSeek as Seek is faster then Select Sql-Command
>
>
SEEK Fld1+Fld2+Fld3 && But here Fld3 is with <> How i use this in combine Seek 
> 


It is not always true that "Seek is faster then Select Sql-Command". There are many discussions on this topic which you can browse if interested.

Presently, if you create separate indexes on fld1, fld2 and fld3, you will get full optimization (also try with having an additional index on deleted() tag)

Check your optimization status with following.

=SYS(3054,11,"cmemvar")
SELECT * FROM Table1 WHERE Fld1 = lcA AND Fld2 = lcB AND Fld3 <> lnC INTO CURSOR TcCnt
?cmemvar



As for the seek command, you will not get the correct result by having a composite index because you want to EXCLUDE fld3 value which you can't do with a seek!

Vivek

Live wisely... because in real world, there is no Ctrl + Z!

ENTIRE THREAD

Seek Vs Select Sql in Speed Posted by Khurram Tahir @ 1/18/2014 2:13:38 PM
RE: Seek Vs Select Sql in Speed Posted by Vivek Deodhar @ 1/18/2014 2:45:54 PM
RE: Seek Vs Select Sql in Speed Posted by Anders Altberg @ 1/18/2014 3:05:54 PM
RE: Seek Vs Select Sql in Speed Posted by Tore Bleken @ 1/18/2014 5:48:53 PM