Hi Ken. Thanks for the quick response.
This is my query:
select stoordra.@4, stoordra.@3, stoordra.@12, stoordra.@61, stoordda.@5,
stoordda.@6, stoordda.@7, stoordda.@8
from stoordra, stoordda
where stoordda.@23 = stoordra.@1 and
stoordda.@22 ='018012' and
stoordra.@12 >='04/01/09' and
stoordra.@12 <='04/30/09' and
stoordra.@47 <> 'Y'
stoordra is our Filepro database of archived orders and stoordda is where the detail (line items) for each order are stored. Since I am using field ID #'s instead of actual names, I'll explain my selection criteria. I am trying to list all of the orders (including line items) for customer #018012 between a range of dates (the date ranges will change from month to month). stoordra.@47 <> 'Y' excludes canceled orders. stoordda.@23 = stoordra.@1 establishes the common field between the parent/child database (in this case order #).
If I understand you correctly, if there is an index built on order date, it would still have to sort through all customers, but it could go straight to the first date in the date range and only run through the dates in the defined date range.
Or - if there was an index built on customer ID, it would have to sort through all line items in the defined date range, but only for customer 018012.
Am I understanding this concept correctly? Could the order in which I am listing the criteria have anything to do with how fast the query processes (i.e. how many records it has to sort through)?
How do you determine what indexes exist for a particular Filepro database?
Thanks.