Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INNER JOIN or Sub-query?
Message
From
20/03/2006 10:16:56
 
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:
01105844
Views:
16
>Hi everybody,
>
>Here is the SQL I'm using
>
>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>>
>
>where lcFilter is
>
>lcFilter = m.lcFilter + [Trans.cResolution_Codes_fk is Null ] + ;
>	[ AND Employee_queue_schedules.tScheduled_time <= ] + ;
>	TimeToStr(dtot(m.tdDate+1)-1) + ;
>	[ AND Trans_employees_queues.iActive_Flag = 1 ] + ;
>	[ AND Employee_queue_schedules.iActive_Flag = 1]
>
>
>As you see, there is no restrictions on Users table. My tcAddtionalJoin passes a join to a temp cursor containing cUserID list and indexed on cUserID field. My question is:
>what would be better in terms of speed: use this kind of join as I presently do or put user's restrictions into where condition, e.g.
>
>and Users.cUserID in (select cUserID from c_temp)
>
>What would you suggest?
>
>Thanks in advance.

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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform