Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


need one doubt clarification application team trying to execute a simple query


need one doubt clarification application team trying to execute a simple query

Author
Message
naga.rohitkumar
naga.rohitkumar
SSChasing Mays
SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)

Group: General Forum Members
Points: 632 Visits: 1378
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
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8235 Visits: 14368
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
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47196 Visits: 44364
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, MVP, M.Sc (Comp Sci)
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


naga.rohitkumar
naga.rohitkumar
SSChasing Mays
SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)

Group: General Forum Members
Points: 632 Visits: 1378
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
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47196 Visits: 44364
Please read Opc's post.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


naga.rohitkumar
naga.rohitkumar
SSChasing Mays
SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)

Group: General Forum Members
Points: 632 Visits: 1378
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
Orlando Colamatteo
Orlando Colamatteo
SSCrazy Eights
SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)SSCrazy Eights (8.2K reputation)

Group: General Forum Members
Points: 8235 Visits: 14368
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
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47196 Visits: 44364
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, MVP, M.Sc (Comp Sci)
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


naga.rohitkumar
naga.rohitkumar
SSChasing Mays
SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)SSChasing Mays (632 reputation)

Group: General Forum Members
Points: 632 Visits: 1378
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
Attachments
Execution plan.JPG (11 views, 88.00 KB)
Bhuvnesh
Bhuvnesh
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2924 Visits: 4076
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;-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search