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


Unknown Query...


Unknown Query...

Author
Message
ard5karthick
ard5karthick
SSC Rookie
SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)SSC Rookie (43 reputation)

Group: General Forum Members
Points: 43 Visits: 162
Hi All,

We have a Cube that will be refreshed daily, and lately its been taking more than an hour for refreshing and as a result Cube refresh process has been failing in many occasions. My Colleague ran the Activity Monitor on the base database and found the below mentioned query running many times. He forwarded it to me asking its purpose.

"
SET NOCOUNT ON;

DECLARE @previous_collection_time datetime;
DECLARE @previous_request_count bigint;
DECLARE @current_collection_time datetime;
DECLARE @current_request_count bigint;
DECLARE @batch_requests_per_sec bigint;
DECLARE @interval_sec bigint;

-- Get the previous snapshot's time and batch request count
SELECT TOP 1 @previous_collection_time = collection_time, @previous_request_count = request_count
FROM #am_request_count
ORDER BY collection_time DESC;

-- Get the current total time and batch request count
SET @current_collection_time = GETDATE();
SELECT @current_request_count = cntr_value
FROM sys.sysperfinfo
WHERE counter_name = 'Batch Requests/sec' COLLATE Latin1_General_BIN;

SET @interval_sec =
-- Avoid divide-by-zero
CASE
WHEN DATEDIFF (second, @previous_collection_time, @current_collection_time) = 0 THEN 1
ELSE DATEDIFF (second, @previous_collection_time, @current_collection_time)
END;

-- Calc the Batch Requests/sec rate for the just-completed time interval.
SET @batch_requests_per_sec = (@current_request_count - @previous_request_count) / @interval_sec;

-- Save off current batch count
INSERT INTO #am_request_count (collection_time, request_count)
VALUES (@current_collection_time, @current_request_count);

-- Return the batch requests/sec rate for the just-completed time interval.
SELECT ISNULL (@batch_requests_per_sec, 0) AS batch_requests_per_sec;

-- Get rid of all but the most recent snapshot's data
DELETE FROM #am_request_count WHERE collection_time < @current_collection_time;

"

After some research on this i came to the conclusion that the query is being generated by the system for event logging.

Can someone please tell me why the above query was generated and what is it used for?

Thanks in advance.
Sreekanth B
Sreekanth B
SSC-Addicted
SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)

Group: General Forum Members
Points: 420 Visits: 1951
Looks like related to Activity Monitor.

See these links...
http://stackoverflow.com/questions/4021428/where-are-all-those-sql-server-sessions-from

http://social.msdn.microsoft.com/Forums/en-US/c8c99b4d-c647-468b-bca8-0790cf7faf84/orchestration-taking-long-time-to-complete-even-though-all-shapes-are-completed-snapshot-?forum=biztalkgeneral

http://www.progtown.com/topic386616-not-clear-process.html
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