Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How much memory usage in sql query ?

Posted on 2011-02-20
1
254 Views
Last Modified: 2012-05-11
If we doing an insert,delete , select or updates, how do we know how much memory sql being use for the operation ? any idea how to check this ?
0
Comment
Question by:motioneye
1 Comment
 
LVL 9

Accepted Solution

by:
s_chilkury earned 500 total points
ID: 34937962
One way is to use PERFMON (SYSMON) to get the values for the above counters alongwith others for further assessment.

To investigate potential memory bottleneck, you can use this query:

SELECT  cntr_value/1024 as 'MBs used'from master.dbo.sysperfinfowhere object_name = 'SQLServer:Memory Manager' and   counter_name = 'Total Server Memory (KB)'

For other counters

SELECT  'ProcedureCache Allocated',     CONVERT(int,((CONVERT(numeric(10,2),cntr_value)* 8192)/1024)/1024)as 'MBs'from master.dbo.sysperfinfowhere object_name = 'SQLServer:Buffer Manager' and   counter_name = 'Procedure cache pages'UNIONSELECT  'Buffer Cache database pages',     CONVERT(int,((CONVERT(numeric(10,2),cntr_value)* 8192)/1024)/1024)as 'MBs'from master.dbo.sysperfinfowhere object_name = 'SQLServer:Buffer Manager' and   counter_name = 'Database pages'UNIONSELECT  'Free pages',     CONVERT(int,((CONVERT(numeric(10,2), cntr_value)* 8192)/1024)/1024)as 'MBs'from master.dbo.sysperfinfowhere object_name = 'SQLServer:Buffer Manager' and   counter_name = 'Free pages'  


Also ... Check the following links:

http://blog.colinmackay.net/archive/2008/07/20/2996.aspx
http://social.msdn.microsoft.com/Forums/en/sqlgetstarted/thread/b860a9c4-27da-4b24-b5bf-097dd99f2629
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question