RE: Quickest Search

Author: Lee Fakes

Posted: 2014-09-02 at 23:25:06

> Date: Wed, 3 Sep 2014 15:33:27 +1200

> Subject: Quickest Search

> From: sytze.kiss@gmail.com

> To: profoxtech@leafe.com

>

> I have a large stock file (say 10,000 records)

> I only have a vague idea what I'm searching for

>

> So, I may have a variable like

>

> srch4="upper(name+code+stkmemo+unitmeas2+altsupply+descopt2+descopt3+descopt4+descopt5+bar2code+bar3code+alt2code)"

>

> Is there a better/quicker way to CONSTRUCT the following

>

> Select Code, desc, price, cost, qoh from winstoks Into Table temp order By

> Code where At(lcSearch,&srch4)>0

>

I had a similar problem a while back and solved it by using seperate where clauses.

I found I was able to optimise the statements by placing the indexed fields first and it prevented cross field matches.

Try something like

Select Code, desc, price, cost, qoh ;

from winstoks ;

where ;

(lcSearch $ name) OR ;

(lcSearch $ code) OR ;

(lcSearch $ stkmemo) OR ;

(lcSearch $ unitmeas2) OR ;

(lcSearch $ altsupply) OR ;

(lcSearch $ descopt2) OR ;

(lcSearch $ descopt3) OR ;

(lcSearch $ descopt4) OR ;

(lcSearch $ descopt5) OR ;

(lcSearch $ bar2code) OR ;

(lcSearch $ bar3code) OR ;

(lcSearch $ alt2code) ;

order By Code ;

Into Table temp

Regards

Lee

> --

> Kind regards,

> Sytze de Boer

> Kiss Software

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> text/html

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BLU175-W334246C919BA589072562885C40@phx.gbl

** 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.

©2014 Lee Fakes