Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to accelerate this query?
Message
 
 
À
30/03/2001 15:14:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00490429
Message ID:
00490450
Vues:
9
>I would like to optimize this query.
>
>
>SELECT MEMBER.*,MAX(LOGIN.CREATION) AS LOGINCREATION FROM LOGIN;
> INNER JOIN MEMBER ON LOGIN.NOMEMBER=MEMBER.NUMERO;
> WHERE MEMBER.NUMERO>=lnNumberStart AND MEMBER.NUMERO<=lnNumberEnd;
>  AND MEMBER.MAILING=1;
> HAVING LOGINCREATION< DATE()-120;
> GROUP BY 1 INTO CURSOR TEMP
>
I don't know about how much more you can optimize as long as you have indexes on Login.NoMember, Login.Creation, Member.Numero and Member.Mailing. I would use BETWEEN() function in the WHERE clause --

WHERE BETWEEN(Member.Numero, lnNumberStart, lnNumberEnd) ...

You could also test performance using 2 SQLs. First --

SELECT NoMember, MAX(Creation) AS LoginCreation FROM Login WHERE Creation < Date() - 120 GROUP BY NoMember INTO CURSOR crsTEMP

Then the second SQL would be

Select MEMBER.*, crsTemp.LoginCreation INNER JOIN Member ON ...
WHERE BETWEEN(Member.Numero, lnNumberStart, lnNumberEnd) ...
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform