Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I optimize this SQL on a network?
Message
 
To
29/11/2007 18:28:12
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01272269
Message ID:
01272278
Views:
12
Since no one can duplicate your client's network setup, have you considered doing benchmark tests to see if there were differences in the performance?

>I sent this message earlier today and got no replies. Could be nobody was interested in responding, could be that it got lost in the shuffle. I'm hoping its the latter ..... so here goes:
>
>I have a new application that I'm releasing soon and I'm wondering about network performance.
>
>The primary bottleneck will be execution of a single SQL statement that will look much like this (it will be different each time, but this is a reasonable example). This SQL is called for each single form the user looks at.
>
>
Select {some_fields} from SalesSummary                     ;
>      into cursor cBrowse readwrite                                  ;
>                                                             ;
>      Where Between( period, lnFirstPeriod, lnLastPeriod) ;
>      And SalesSummary.CustNumber in (Select CustNumber from CustomerSummary;
>            where ACustClass in (select Left(DrillValue,20) from cDrillDown where Depth = 1)) ;
>      And SalesSummary.CustNumber in (Select CustNumber from CustomerSummary ;
>           where ACustID in (select Left(DrillValue,15) from cDrillDown where Depth = 2));
>      group by {some_other_fields}
>Two questions:
>(1) SalesSummary is a free table on a network. It is skinny (60 bytes) with about 500K records. It also is, in effect, read-only ... it is created hourly elsewhere, and this application merely reads it. Would it be more efficient to copy this file to a local TEMP directory instead of reading it over the network?
>
>(2) Would it be more efficient to eliminate one level of the subqueries, like this?
>
>
Select CustNumber from CustomerSummary;
>      where ACustClass in (select Left(DrillValue,20) from cDrillDown where Depth = 1);
>      into cursor cTemp1
>
>Select CustNumber from CustomerSummary ;
>     where ACustID in (select Left(DrillValue,15) from cDrillDown where Depth = 2);
>     into cursor cTemp2
>
>Select {some_fields} from SalesSummary                     ;
>      into cursor cBrowse readwrite                                  ;
>;
>      Where Between( period, lnFirstPeriod, lnLastPeriod)    ;
>      And SalesSummary.CustNumber in (Select * from cTemp1)  ;
>      And SalesSummary.CustNumber in (Select * from cTemp2  );
>      group by {some_other_fields}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform