Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INNER JOIN or Sub-query?
Message
 
 
To
20/03/2006 10:43:23
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01105835
Message ID:
01105862
Views:
24
>>>join can to be faster but it is formally incorrect.
>>>if you use c_temp here once only, doesn't index it, vfp does this in a faster way
>>
>>Are you sure I don't have to index this c_temp cursor? I added the index today in the morning, it seemed to degrade performance...
>>
>>Thanks.
>
>VFP build a temp index on the fly.
>
>What is RECCOUNT("c_temp") ?
>
>Why have you cUserId and iUserId ?

BTW, I didn't post the whole select. Here it is:
text TO lcSQLStr NOSHOW TEXTMERGE PRETEXT 7
	SELECT <<m.lcFieldList>> ;
	FROM TRANS INNER JOIN Trans_employees_queues ;
	ON Trans.cTrans_pk = Trans_employees_queues.cTrans_fk ;
	INNER JOIN UsGrLink ON ;
	Trans_employees_queues.cCommission_owner_usgrlink_fk = Usgrlink.cUsgrlink_pk ;
	INNER JOIN USERS ON Users.iID = Usgrlink.iUserID ;
	<<m.tcAdditionalJoin>> ;
	INNER JOIN Employee_queue_schedules ;
	ON Trans_employees_queues.cTrans_employees_queues_pk = ;
	Employee_queue_schedules.cTrans_employees_queues_fk ;
	WHERE <<m.lcFilter>> ;
	<<m.lcGroupBy>> ;
	UNION ;
	SELECT  <<m.lcFieldList>> ;
	FROM TRANS INNER JOIN Trans_employees_queues ;
	ON Trans.cTrans_pk = Trans_employees_queues.ctrans_fk ;
	INNER JOIN UsGrLink ON ;
	Trans_employees_queues.cUsgrlink_fk = Usgrlink.cUsgrlink_pk ;
	INNER JOIN USERS ON Users.iID = Usgrlink.iUserID ;
	<<m.tcAdditionalJoin>> ;
	INNER JOIN Employee_queue_schedules ;
	ON Trans_employees_queues.cTrans_employees_queues_pk = ;
	Employee_queue_schedules.cTrans_employees_queues_fk ;
	WHERE <<m.lcFilter>> ;
	<<m.lcGroupBy>> ;
	UNION ;
	SELECT <<m.lcFieldList>> ;
	FROM TRANS INNER JOIN Trans_employees_queues ;
	ON Trans.ctrans_pk = Trans_employees_queues.ctrans_fk ;
	INNER JOIN UsGrLink ;
	ON Trans_employees_queues.cSupervisor_review_usgrlink_fk = Usgrlink.cUsgrlink_pk ;
	INNER JOIN USERS ON Users.iID = Usgrlink.iUserID ;
	<<m.tcAdditionalJoin>> ;
	INNER JOIN Employee_queue_schedules ;
	ON Trans_employees_queues.cTrans_employees_queues_pk = ;
	Employee_queue_schedules.cTrans_employees_queues_fk ;
	WHERE <<m.lcFilter>> ;
	<<m.lcGroupBy>>
ENDTEXT

return RunSQL(m.lcSQLStr, m.tcAlias)
In other words, c_temp is used 3 times in the query. Do you think I still should remove index from my class (I did it a second ago), but haven't re-tested yet, because I noticed some minor interface problems in these forms which I'm correcting in the meantime...
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform