|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 5:34 AM
Points: 525,
Visits: 997
|
|
hi all need one doubt clarification application team trying to execute a simple query but its taking long time i tried evry thing suppose if we rebuild the indexes of the table in a database which the query is using ! wiill it be any impact on the production server performance or after rebuilding the table wheter we have to rearrrange the colums of the table which previous ly having ? can we rebuild the index if we do so will it increase performance of the query
Thanks & Regards NAGA.ROHITKUMAR
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 7:22 AM
Points: 6,693,
Visits: 11,707
|
|
You are not providing nearly enough info to enable us to effectively help you. Post the slow query, all table definitons (including indexes) for tables involved in the query and the actual execution plan for the query.
Please read this article:
How to Post Performance Problems By Gail Shaw
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 5:34 AM
Points: 525,
Visits: 997
|
|
this is the query select count(*) from acmt when we execute this output has to display the records count in it
but some times it is taking 12 to 20 mins also actuall execution time is 2 to 10 secs
Thanks & Regards NAGA.ROHITKUMAR
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
Please read Opc's post.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 5:34 AM
Points: 525,
Visits: 997
|
|
select count(*) from acmt
1. if the query is getting slow to execute what should we check in activity monitor other than spid !
2. can we trace any thing in the activity monitor lock by object if so what is it?
Thanks & Regards NAGA.ROHITKUMAR
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 7:22 AM
Points: 6,693,
Visits: 11,707
|
|
It could be any number of things but from the information you provided so far it sounds like you may be experiencing intermittent blocking. Select count(*) with no where-clause means the entire table will require a scan. There's really no way to make that go faster. If anything else is running that has an exclusive lock on any part of the table needed by the scan then the count(*) query will be forced to wait.
INF: Understanding and resolving SQL Server blocking problems
How many rows are in the table? Start looking at what else is going on in the database when the query starts taking a long time. Forget Activity Monitor. Start getting familiar with the DMVs
From SQL Server: Transaction Management
-- Look for blocking
SELECT tl.resource_type , tl.resource_database_id , tl.resource_associated_entity_id , tl.request_mode , tl.request_session_id , wt.blocking_session_id , wt.wait_type , wt.wait_duration_ms FROM sys.dm_tran_locks AS tl INNER JOIN sys.dm_os_waiting_tasks AS wt ON tl.lock_owner_address = wt.resource_address ORDER BY wait_duration_ms DESC ;
__________________________________________________________________________________________________ There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Believe you can and you're halfway there. --Theodore Roosevelt
Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein
The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein
1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 12:59 PM
Points: 37,640,
Visits: 29,895
|
|
opc.three (11/27/2012) Select count(*) with no where-clause means the entire table will require a scan.
It's a view, not a table (stated as such in a different thread).
Naga, as Opc stated earlier, we need more information (not the same info posted again). The view definition, the table definitions, the index definitions, the execution plan.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 5:34 AM
Points: 525,
Visits: 997
|
|
here by the below execution plan states that it is going for full table scan and taking 79% of table and first table is taking 117mb nearly and second table is taking the 600mb nearly and it is a having indexes properly in both the tables
Thanks & Regards NAGA.ROHITKUMAR
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562,
Visits: 3,451
|
|
naga.rohitkumar (12/3/2012) it is a having indexes properly in both the tables NO use of here as both the tables are going for table scan plus parallelism too for puling out heavy data. can you post the related query too ?
-------Bhuvnesh---------- While 1 = 1 (Learning SQL....) Click to get fast response of your post
|
|
|
|