RE: Query taking 4 minutes...ugh

2012-08-21 Thread Dave Crozier
...@leafe.com [mailto:profox-boun...@leafe.com] On Behalf Of MB Software Solutions General Account Sent: 20 August 2012 19:16 To: ProFox Email List Subject: Re: Query taking 4 minutes...ugh On Mon, August 20, 2012 2:13 pm, Stephen Russell wrote: On Mon, Aug 20, 2012 at 12:27 PM, MB Software Solutions General

RE: Query taking 4 minutes...ugh

2012-08-21 Thread MB Software Solutions General Account
On Tue, August 21, 2012 4:03 am, Dave Crozier wrote: I just ran a test as I also didn't think the from was evaluated for each line (why should it be?) and can categorically confirm that it makes no difference whatsoever. As Stephen says, it is only evaluated once to open up the table. Many

Re: Query taking 4 minutes...ugh

2012-08-21 Thread Stephen Russell
On Tue, Aug 21, 2012 at 9:14 AM, MB Software Solutions General Account mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: On Tue, August 21, 2012 4:03 am, Dave Crozier wrote: I just ran a test as I also didn't think the from was evaluated for each line (why should it be?) and can categorically

Re: Query taking 4 minutes...ugh

2012-08-21 Thread MB Software Solutions General Account
On Tue, August 21, 2012 10:38 am, Stephen Russell wrote: snipped Now you can see how the Index is used for #s 1-2-3. Don't think that the engine can substitute one index for a join and another for the where. It just picks the BEST one it can for the overall process. VFP uses multiple

Re: Query taking 4 minutes...ugh

2012-08-20 Thread MB Software Solutions General Account
On Fri, August 17, 2012 12:29 am, Bill Anderson wrote: Store the AddBS() function and the cClaimsTable reference to variables, then use those variables in the SELECT statement. You're evaluating each expression with every row. I used TEXT/ENDTEXT and textmerged these all into my variable

Re: Query taking 4 minutes...ugh

2012-08-20 Thread Stephen Russell
On Mon, Aug 20, 2012 at 12:27 PM, MB Software Solutions General Account mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: On Fri, August 17, 2012 12:29 am, Bill Anderson wrote: Store the AddBS() function and the cClaimsTable reference to variables, then use those variables in the SELECT

Re: Query taking 4 minutes...ugh

2012-08-20 Thread MB Software Solutions General Account
On Mon, August 20, 2012 2:13 pm, Stephen Russell wrote: On Mon, Aug 20, 2012 at 12:27 PM, MB Software Solutions General Account mbsoftwaresoluti...@mbsoftwaresolutions.com wrote: On Fri, August 17, 2012 12:29 am, Bill Anderson wrote: Store the AddBS() function and the cClaimsTable reference

RE: Query taking 4 minutes...ugh

2012-08-17 Thread Richard Kaye
Good spot, Bill! -- rk -Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of Bill Anderson Sent: Friday, August 17, 2012 12:29 AM To: profoxt...@leafe.com Subject: Re: Query taking 4 minutes...ugh Store the AddBS() function

Re: Query taking 4 minutes...ugh

2012-08-17 Thread MB Software Solutions General Account
On Fri, August 17, 2012 12:29 am, Bill Anderson wrote: Store the AddBS() function and the cClaimsTable reference to variables, then use those variables in the SELECT statement. You're evaluating each expression with every row. Noreally? But that's not part of the SELECT fields; it's

Re: Query taking 4 minutes...ugh

2012-08-16 Thread Alan Bourke
If you do: Use (ADDBS(this.cDataPath)+this.cClaimsTable) in 0 alias x1 Use (ADDBS(this.cDataPath)+this.cDischargeTable) in 0 alias x2 Select provnum from x1 Union select provnum from x2 Into Cursor curTemp ... is that any quicker? How big are these tables? -- Alan Bourke alanpbourke

Re: Query taking 4 minutes...ugh

2012-08-16 Thread Alan Bourke
On Thu, Aug 16, 2012, at 03:28 PM, MB Software Solutions General Account wrote: VFP9SP2 - WinXP - dbfs on network How fast is the network link? -- Alan Bourke alanpbourke (at) fastmail (dot) fm ___ Post Messages to: ProFox@leafe.com

Re: Query taking 4 minutes...ugh

2012-08-16 Thread Peter Cushing
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 ;

RE: Query taking 4 minutes...ugh

2012-08-16 Thread Richard Kaye
You didn't say how many rows are in these tables. Go xBase. Try COPY TO and APPEND FROM. -- rk -Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of MB Software Solutions General Account Sent: Thursday, August 16, 2012 10:29 AM To:

Re: Query taking 4 minutes...ugh

2012-08-16 Thread MB Software Solutions General Account
On Thu, August 16, 2012 10:39 am, Alan Bourke wrote: How big are these tables? Yeah sorry...just realized I forgot that detail! Claims is 2.5 million rows, and Discharge is 65,000. Of course there's an index on provnum in both tables. Those tables record count will grow over time.

Re: Query taking 4 minutes...ugh

2012-08-16 Thread MB Software Solutions General Account
On Thu, August 16, 2012 10:39 am, Alan Bourke wrote: How fast is the network link? 100mb network ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list:

Re: Query taking 4 minutes...ugh

2012-08-16 Thread MB Software Solutions General Account
On Thu, August 16, 2012 10:51 am, Peter Cushing wrote: 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

RE: Query taking 4 minutes...ugh

2012-08-16 Thread MB Software Solutions General Account
On Thu, August 16, 2012 10:57 am, Richard Kaye wrote: You didn't say how many rows are in these tables. Sorry. Sent just a bit ago. Go xBase. Try COPY TO and APPEND FROM. I'm using APPEND FROM to get the text files into the DBFs. I'll just add a function to make sure a local 'distinct

RE: Query taking 4 minutes...ugh

2012-08-16 Thread Dave Crozier
Mike, If you have lots of duplicate provnum fields in cClaimstable then have you tried select distinct in both the selects. This should be quicker (I think), especially in the 2.5m row table. Dave --- This communication and the

Re: Query taking 4 minutes...ugh

2012-08-16 Thread Bill Anderson
Store the AddBS() function and the cClaimsTable reference to variables, then use those variables in the SELECT statement. You're evaluating each expression with every row. Bill Anderson On Thursday, August 16, 2012, MB Software Solutions General Account wrote: VFP9SP2 - WinXP - dbfs on