Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to accelerate this query?
Message
 
 
To
30/03/2001 15:14:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00490429
Message ID:
00490450
Views:
8
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform