Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query can not be optimized?
Message
De
03/10/2006 06:12:48
Thomas Ganss (En ligne)
Main Trend
Frankfurt, Allemagne
 
 
À
02/10/2006 11:23:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01158559
Message ID:
01158808
Vues:
25
>
>select *;
>  from person p
> inner join referral r on p.cl_ref = r.cl_ref and !empty(r.re_date);
>      where gomonth(p.cl_dob, 216) > (select min(rr.re_date) from referral rr;
>                                             where rr.cl_ref = p.cl_ref and !empty(rr.re_date))
>
>
>According to Fox none of this is optimised, both cl_ref fields on each table are indexed.
>
>Can anyone suggest an alternative that may be quicker - or is there anything else I could do to speed up the query?

Sys(3054) has to be interpreted carefully <g>.
You probabably would get rushmore optimized filtering if you had an index on
r.re_date and switched to r.re_date<>{..} as empty is not rushmore-optimizable.
***WARNING*** Having sys(3054) state that the the table is optimized can actually be working slower if none or very few records are cought by that filter, especially if the table sits on another machine. Check the selectivity of such an index FIRST!

INdexing on "gomonth(p.cl_dob, 216)" or "cl_dob *and* moving the calculation into the select" are probably better for speeding up your query. Experiment <g>.

the index on cl_ref should be used, but will probably shown in the sys(3054)-line as used by the join, not by rushmore.

HTH

thomas
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform