MB Software Solutions General Account wrote: > VFP9SP2 - WinXP - dbfs on network > > I have to query 2 tables to populate a lookup list: > > SELECT x1.provnum ; > FROM (ADDBS(this.cDataPath)+this.cClaimsTable) x1 ; > UNION ; > SELECT x2.provnum ; > FROM (ADDBS(this.cDataPath)+this.cDischargeTable) x2 ; > INTO CURSOR curTemp > > This query is taking forever (4 minutes!). There's no WHERE clause so > it's not optimizable. But is there a better way? > > My current plan now is to create logic that extracts the provnums into a > separate table and just query that. That makes complete sense to me. > (These tables are basically input files from a vendor, with the provnum > built in and not sent in a separate lookup table.) > > Other ideas? > > If all you are doing is checking if the provnum is valid you could just seek into both tables (assuming it is indexed). Should be quick enough.
* assume open with above aliases and order set. if seek(mytestvalue,'X1') or seek(mytestvalue,'X2') * value is ok else * value not ok endif Peter ---------------------------------------------------------------- Rajan Imports has changed - we are now Whispering Smith Ltd. For more information see our website at www.whisperingsmith.com Please update your address book with my new email address: pcush...@whisperingsmith.com . This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. www.whisperingsmith.com Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715 London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960 _______________________________________________ Post Messages to: ProFox@leafe.com 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/502d08e3.3000...@whisperingsmith.com ** 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.