Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 reducing the execution time of a query

Author  Topic 

iamsmahd
Yak Posting Veteran

55 Posts

Posted - 2006-01-04 : 02:26:58
Hi all.
I have a query (Q1) which consists of 3 main parts (p1, p2, p3) as 3 subqueries.

all of them are ratherly the same and differ in one number::

p1 : select * from t1 inner join t2...... where t2.crsLevel = 2

p2 : select * from t1 inner join t2...... where t2.crsLevel = 1

p3 : select * from t1 inner join t2...... where t2.crsLevel = 6

I made a function for them (f1) which has 1 input variable and call it with different inputs to execute p1, p2 and p3. But still Q1 is slow.

now my question is : my query (Q1) needs long time to execute. HOW CAN I improve the execution time ? IS there any way for it ?

THANK YOU VERY MUCH



sonia

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-04 : 02:46:52
Run you query in the Query Analyser with show executon plan on.
Also refer to this http://www.sql-server-performance.com/query_execution_plan_analysis.asp
-----------------
[KH]

2006 a new beginning
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-04 : 03:15:29
How many data do each table have?
Do the tables have proper indices?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -