Upgrade for sp_who2 called sp_who3

Published On: 2007-10-24By:

I’ve published this before over on tek-tips.com, but I figured that I’d republish it here as well.  I’ve written an update for sp_who2 which I call sp_who3.  It can be most useful when trying to diagnose slow running queries as it can provide a wealth of information in a single screen.

Usage:
exec sp_who3
exec sp_who3 active
exec sp_who3 blocked
exec sp_who3 72 /*Any active spid*/

Download: SQL 7 / SQL 2000 / SQL 2005

Download from mrdenny.com

When using no parameter the output will match the output of sp_who2.

When using the “active” keyword the output will match the output of sp_who2 active.

When using the “blocked” keyword the output will have the same columns as sp_who3 active but show only the blocking and blocked processes.

This procedure has been used at companies like IGN / GameSpy, MySpace, Awareness Technologies, and Triad Financial to name a few.

How SQL decides how much procedure cache and how much buffer cache to use.

Published On: 2007-10-22By:

There are two main types of cache which SQL Server deals with, the buffer cache and the procedure cache.  The procedure cache is where the execution plans for procedures and queries are stored.  The buffer cache is where the actual data is cached so that SQL Server doesn’t have to go to disk to get often accessed data.

The version of SQL Server that you are running will determine how SQL calculates the maximum size of the procedure cache.

SQL 2000 – 50% of the memory or 1 Gig which ever is lower

SQL 2005 RTM to SP1 – 75% of the first 8 Gigs of RAM + 50% of the next 56 Gigs of RAM + 25% of the ram over 64 Gigs.

SQL 2005 SP2 and up – 75% of the first 4 Gigs of RAM + 10% of the ram over 4 Gigs

As I understand the reason for the change the original settings were causing SQL Server to lockup for some customers as not enough RAM was left over for the buffer cache.

If you are using SQL 2005 in a Win32 platform these calculations change again as the procedure cache must remain within the first 2 Gigs of memory giving you a max of 2 Gigs of procedure cache no matter how much memory you install.

Denny

Excellent Lock Pages in Memory Blog

Published On: 2007-10-18By:

Bob Ward of Microsoft has written an excellent blog about the lock pages is memory right over on the PSS blog.

What does the min server memory setting actually mean?

Published On: 2007-10-17By:

I know that there is some confusion about what exactly the minimum server memory setting in sp_configure actually does.  When I was at PASS I was able to ask the Microsoft guys this very question and here is what they told me.

 The setting does not control how much memory SQL takes when it starts up.  What it controls is a low watermark as to how much memory SQL will keep. 

For example if you have 2 Gigs of memory installed, and a min memory setting on 1024 MB and a max memory setting of 1536 MB and Windows starts telling SQL that it needs more memory SQL will give the memory back until it hits the 1024 MB lower limit.  Once it hits that limit it will no longer give memory back to Windows.

 Denny

1 392 393 394 395

Video

Globally Recognized Expertise

As Microsoft MVP’s and Partners as well as VMware experts, we are summoned by companies all over the world to fine-tune and problem-solve the most difficult architecture, infrastructure and network challenges.

And sometimes we’re asked to share what we did, at events like Microsoft’s PASS Summit 2015.