November 22, 2012 at 10:29 pm
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
November 23, 2012 at 10:38 pm
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[/url]
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
November 24, 2012 at 2:09 am
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
(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
November 26, 2012 at 12:17 am
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
November 26, 2012 at 12:29 am
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
November 27, 2012 at 2:47 am
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
November 27, 2012 at 3:56 am
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
November 27, 2012 at 7:16 am
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
December 3, 2012 at 3:49 am
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
December 3, 2012 at 3:58 am
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;-)
December 3, 2012 at 4:04 am
Not a picture of the exec plan, which is fairly useless. The execution plan saved to a file. Plus the view definition, the table definitions, the index definitions.
Please read the article that Opc posted in his first reply on this thread.
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
December 3, 2012 at 4:22 am
the query is also in the execution plan out put and application team frequently check
this simple query to check the count ---->> select count(*) from acmt
Thanks
Naga.Rohitkumar
December 3, 2012 at 4:36 am
We need the execution plan as a SQLPLAN file.
We also need the CREATE VIEW definition
We also need the CREATE TABLE definition of all the tables in the query and or view
We also need all the CREATE INDEX definitions of all the indexes on all the tables in the query
We also need the FULL SQL STATEMENT used when generating the execution plan.
Please follow the links in my signature, on posting performance problems and how to post code and data. Without this we cannot help you further.
Remember we cannot see what you can see.
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply