On 2/9/2011 1:59 PM, Sytze de Boer wrote: > Hi foxers > > I have a table called WINHST > This table has 10 indexes > The 7th index is on a field called SERNO. Expression is upper(serno) > > trcask = the search expression > Select * From winhst Where serno=trcask Order By invnum Into Table (myfile) > > Question 1 > In order to speed the search, should I do the following? > sele winhst > set order to 7 > Select * From winhst Where serno=trcask Order By invnum Into Table (myfile) > > > Question 2 > Does the "order by" clause slow down the select issue ? > >
Answer 1 -- you do not need to set the order. VFP will look at the WHERE clause in your SQL and if there's an indexed expression, it will use the index. See SYS(3054) for ways to identify what optimizations are used. Very nice function to check your SQL statements! Answer 2 -- negligible if not too many records returned. Consider a local index on the cursor AFTER your return the records if it's a huge recordset. -- Mike Babcock, MCP MB Software Solutions, LLC President, Chief Software Architect http://mbsoftwaresolutions.com http://fabmate.com http://twitter.com/mbabcock16 _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

