Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query can not be optimized?
Message
From
05/10/2006 13:43:53
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
05/10/2006 11:37:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01158559
Message ID:
01159791
Views:
21
Hi Fabio,
SELECT P.*,r.*;
	FROM;
	FORCE (select cl_ref , min(re_date) re_date from referral rr WHERE re_date<>{} GROUP BY 1) X;
	JOIN person p ON p.cl_ref=x.cl_ref AND gomonth(p.cl_dob, 216) > x.re_date;
	JOIN referral r on r.cl_ref = p.cl_ref ;
	WHERE {} <> r.re_date
for us it is quite clear that because of the group by only 1 combination of cl_ref and min_re_date can exist in the subselect. I am pretty sure that the only way for the vfp optimizer to work is to define a SQL way utilizing a compound index with both conditions. If the date part checked on equality, checking against cl_Ref + dtos(re_date) would surely use an existing compound index for optimization.

regards

thomas
Previous
Reply
Map
View

Click here to load this message in the networking platform