Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

need one doubt clarification application team trying to execute a simple query Expand / Collapse
Author
Message
Posted Thursday, November 22, 2012 10:29 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, October 17, 2014 9:23 AM
Points: 585, Visits: 1,295
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
Naga.Rohitkumar
Post #1388027
Posted Friday, November 23, 2012 10:38 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:06 PM
Points: 7,125, Visits: 12,720
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
Post #1388276
Posted Saturday, November 24, 2012 2:09 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:09 PM
Points: 40,172, Visits: 36,560
naga.rohitkumar (11/22/2012)
or after rebuilding the table wheter we have to rearrrange the colums of the table which previous ly having


Order of columns in a table has no meaning.

can we rebuild the index if we do so will it increase performance of the query


Probably not. To make a query run faster, tune the query. May involve rewriting the query, may involve indexes.

Chapters 3, 6 and 7 http://www.simple-talk.com/books/sql-books/troubleshooting-sql-server-a-guide-for-the-accidental-dba/
and
http://www.simple-talk.com/sql/performance/finding-the-causes-of-poor-performance-in-sql-server,-part-1/
http://www.simple-talk.com/sql/performance/finding-the-causes-of-poor-performance-in-sql-server,-part-2/

(both of which I have referred you to before)



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

Post #1388289
Posted Monday, November 26, 2012 12:17 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, October 17, 2014 9:23 AM
Points: 585, Visits: 1,295
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
Naga.Rohitkumar
Post #1388447
Posted Monday, November 26, 2012 12:29 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:09 PM
Points: 40,172, Visits: 36,560
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

Post #1388450
Posted Tuesday, November 27, 2012 2:47 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, October 17, 2014 9:23 AM
Points: 585, Visits: 1,295
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
Naga.Rohitkumar
Post #1389034
Posted Tuesday, November 27, 2012 3:56 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:06 PM
Points: 7,125, Visits: 12,720
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
Post #1389063
Posted Tuesday, November 27, 2012 7:16 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:09 PM
Points: 40,172, Visits: 36,560
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

Post #1389179
Posted Monday, December 3, 2012 3:49 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, October 17, 2014 9:23 AM
Points: 585, Visits: 1,295
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
Naga.Rohitkumar


  Post Attachments 
Execution plan.JPG (11 views, 88.39 KB)
Post #1391835
Posted Monday, December 3, 2012 3:58 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, October 6, 2014 5:46 AM
Points: 2,840, Visits: 3,969
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----------
I work only to learn Sql Server...though my company pays me for getting their stuff done
Post #1391837
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse