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 Administration (2000)
 Performance issue on SQL server 2000 Standard Edit

Author  Topic 

hkpindia
Starting Member

2 Posts

Posted - 2008-12-22 : 08:15:36
Hi,

We had performance issue on one of our produciotn server. We have weekly jobs running to defrage indexes if fragmentation is beyond 80%. Statistics are being updated weekly.
We had issue with one query and it was taking more than 2 hours and for some of the user it was running for ever.
Once we dropped and re- created only non clustered indexes on one table (Task table, the largest in the query used), teh querry took only 25 secs. DBCC checkDB was showing no error before index rebuild.
Can some one help me to understand this behaviour? If require, we are ready to open a case with Microsoft PSS team.

Query:
SELECT distinct pw.wbs_id, pw.proj_id, pw.obs_id, pw.status_code, pw.seq_num, pw.wbs_short_name, pw.wbs_name, pw.parent_wbs_id, pw.proj_node_flag
FROM projwbs pw
WHERE ( pw.proj_id IN (SELECT proj_id
FROM UACCESS
WHERE USER_ID = 583 AND ACCESS_FLAG = 'Y')) OR ( exists ( Select t.wbs_id
FROM task t, taskrsrc tr, rsrc r
Where pw.wbs_id=t.wbs_id And r.ts_approve_user_id = '583' AND tr.rsrc_id = r.rsrc_id AND t.task_id = tr.task_id ) )
ORDER BY 1


Hemant Patel

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-22 : 08:24:05
You only defragment if fragmentation is over 80% ? That is quite large value.
Try defragmentation if fragmentation level is over 30% instead. Or even 20%.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-22 : 08:29:16
Try this query suggestion to see if there is a speed difference
SELECT DISTINCT	pw.wbs_id,
pw.proj_id,
pw.obs_id,
pw.status_code,
pw.seq_num,
pw.wbs_short_name,
pw.wbs_name,
pw.parent_wbs_id,
pw.proj_node_flag
FROM projwbs as pw
LEFT JOIN (
SELECT proj_id
FROM UACCESS
WHERE USER_ID = 583
AND ACCESS_FLAG = 'Y'
GROUP BY proj_id
) AS s ON s.proj_id = pw.proj_id
LEFT JOIN (
SELECT t.wbs_id
FROM task as t
INNER JOIN taskrsrc AS tr ON tr.task_id = t.task_id
INNER JOIN rsrc AS r ON r.rsrc_id = tr.rsrc_id
WHERE r.ts_approve_user_id = '583'
GROUP BY t.wbs_id
) AS t ON t.wbs_id = pw.wbs_id
WHERE s.proj_id IS NOT NULL
OR t.wbs_id IS NOT NULL
ORDER BY pw.wbs_id



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -