Click here to Skip to main content
15,887,135 members
Home / Discussions / Database
   

Database

 
GeneralRe: Left Outter JOIN Pin
polishprogrammer10-Oct-08 6:47
polishprogrammer10-Oct-08 6:47 
Questionsql hierarchal data retrieval Pin
sana1710-Oct-08 5:11
sana1710-Oct-08 5:11 
AnswerRe: sql hierarchal data retrieval Pin
Wendelius10-Oct-08 6:40
mentorWendelius10-Oct-08 6:40 
GeneralRe: sql hierarchal data retrieval Pin
sana1710-Oct-08 6:53
sana1710-Oct-08 6:53 
GeneralRe: sql hierarchal data retrieval Pin
Wendelius10-Oct-08 6:58
mentorWendelius10-Oct-08 6:58 
GeneralRe: sql hierarchal data retrieval Pin
Giorgi Dalakishvili10-Oct-08 8:36
mentorGiorgi Dalakishvili10-Oct-08 8:36 
GeneralRe: sql hierarchal data retrieval Pin
sana1711-Oct-08 4:27
sana1711-Oct-08 4:27 
QuestionPerformance Issue in Query Pin
ashwanigl10-Oct-08 4:18
ashwanigl10-Oct-08 4:18 
There is a "ent.tbl_NetworkProfileTemplate" table in the system
with the following columns

PK_NetworkProfileTemplateId,
ProfileTemplateName,
ProfileTemplateDescription,
FK_TenantId


For TenantId =1 there are about 50000 records and for TenantId = 2 there are 1000000 records.


There is also another table tbl_Tenant which contains information about the tenant.

Now When I execute the following statement by logging in with tenant = 1

select * from ent.tbl_NetworkProfileTemplate
where ent.tbl_NetworkProfileTemplate.FK_TenantId
= ( select PK_TenantId FROM ent.tbl_Tenant WHERE TenantDBUserName = System_User)

This query runs very fast takes less than second to execute and returns number of records = 50000


But if I execute the following statement it takes 45 seconds

select * from ent.tbl_NetworkProfileTemplate
where ent.tbl_NetworkProfileTemplate.FK_TenantId
= [ent].GetTenantId()

The only thing I am doing in this statement is calling a UDF GetTenantId which actually executes the statement
select PK_TenantId FROM ent.tbl_Tenant WHERE TenantDBUserName = System_User


I am not able to understand why the response time is so different.
AnswerRe: Performance Issue in Query Pin
Ashfield10-Oct-08 4:29
Ashfield10-Oct-08 4:29 
GeneralRe: Performance Issue in Query Pin
ashwanigl10-Oct-08 4:32
ashwanigl10-Oct-08 4:32 
GeneralRe: Performance Issue in Query Pin
Ashfield10-Oct-08 4:45
Ashfield10-Oct-08 4:45 
GeneralRe: Performance Issue in Query Pin
Mycroft Holmes11-Oct-08 0:39
professionalMycroft Holmes11-Oct-08 0:39 
QuestionSQL Server 2000 to SQL Server 2005 Pin
amit201110-Oct-08 3:54
amit201110-Oct-08 3:54 
AnswerRe: SQL Server 2000 to SQL Server 2005 Pin
Ashfield10-Oct-08 4:31
Ashfield10-Oct-08 4:31 
QuestionSSIS Job Execution Problem Pin
Vimalsoft(Pty) Ltd9-Oct-08 23:37
professionalVimalsoft(Pty) Ltd9-Oct-08 23:37 
Questionsql/oracle Pin
andreas_6359-Oct-08 5:00
andreas_6359-Oct-08 5:00 
AnswerRe: sql/oracle Pin
Al Ortega9-Oct-08 5:33
Al Ortega9-Oct-08 5:33 
GeneralRe: sql/oracle Pin
andreas_6359-Oct-08 5:44
andreas_6359-Oct-08 5:44 
GeneralRe: sql/oracle Pin
andreas_6359-Oct-08 5:46
andreas_6359-Oct-08 5:46 
GeneralRe: sql/oracle Pin
J4amieC9-Oct-08 5:58
J4amieC9-Oct-08 5:58 
GeneralRe: sql/oracle Pin
Al Ortega9-Oct-08 6:57
Al Ortega9-Oct-08 6:57 
GeneralRe: sql/oracle Pin
Mycroft Holmes9-Oct-08 15:56
professionalMycroft Holmes9-Oct-08 15:56 
GeneralRe: sql/oracle Pin
Al Ortega10-Oct-08 1:09
Al Ortega10-Oct-08 1:09 
GeneralRe: sql/oracle Pin
Paul Conrad9-Oct-08 7:19
professionalPaul Conrad9-Oct-08 7:19 
QuestionDifference b/w Inline View and Derived Table Pin
Gamzun9-Oct-08 4:49
Gamzun9-Oct-08 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.