Click to See Complete Forum and Search --> : Slow Query Processing


guptamkomal
May 28th, 2007, 06:16 AM
SELECT DISTINCT "MCOMP"."MCMP_NAME", "MLOC"."MLOC_NAME", "MDEP"."MDEP_NAME", "TDAY"."TDAY_EMPCDE", "MEMPOFF"."MEMP_NAME", "TDAY"."TDAY_SFTREPO", "TDAY"."TDAY_DATE", "TDAY"."TDAY_EXHR", "TDAY"."TDAY_SFTASSG", "MEMPOFF"."MEMP_CODE"
FROM ((("krishna"."dbo"."TDAY" "TDAY" INNER JOIN "krishna"."dbo"."MEMPOFF" "MEMPOFF" ON "TDAY"."TDAY_EMPCDE"="MEMPOFF"."MEMP_CODE") INNER JOIN "krishna"."dbo"."MCOMP" "MCOMP" ON "MEMPOFF"."MEMP_CMPCD"="MCOMP"."MCMP_CODE") INNER JOIN "krishna"."dbo"."MDEP" "MDEP" ON "MEMPOFF"."MEMP_DEPCD"="MDEP"."MDEP_CODE") INNER JOIN "krishna"."dbo"."MLOC" "MLOC" ON "MEMPOFF"."MEMP_LOCCD"="MLOC"."MLOC_CODE"
ORDER BY "MCOMP"."MCMP_NAME", "MLOC"."MLOC_NAME", "MDEP"."MDEP_NAME", "MEMPOFF"."MEMP_NAME"

I am using Crystal Report XI and SQL Server 2000.
This is my SQL Query,Generated by the Database -> Show SQL Query.
If I am running this Query in SQL Query Analyzer than it takes above 15 min to show the output, and there are 1039131 records from this output.
Is there is any way to reduse the time it takes to show the output.

Thanks

Regards,
Komal.

mcmcom
May 29th, 2007, 03:11 PM
it would seem you have some issues with your joins perhaps. Also why are you doing a distinct select on something with multiple columns and rows. Thats not "usual"

Have you tested the query in SQL itself ?

mcm

TheCPUWizard
May 29th, 2007, 03:19 PM
What are the estimated and actual Query Execution Plans????