Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

How much memory usage in sql query ?

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
motioneye
Asked:
motioneye
1 Solution
 
s_chilkuryCommented:
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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now