Sign in to follow this  
MrRage

[web] This normal? SQL Server memory allocation

Recommended Posts

MrRage    127
... try { SqlCommand cmd = new SqlCommand(sqlString, connection); cmd.Parameters.AddWithValue("@time", time); cmd.ExecuteNonQuery(); } catch (...){...} ... It was a simple .NET application, a while loop that used a single database connection and did a series of inserts using a SqlCommand object. The application never bloated and the memory for this application remained stable. However, SQL Server 2005 proceeded to allocate up to its memory limit almost immediately. There were about 20,000 inserts made over the course of an hour I think, and even though the database was only 28mb on the disk – SQL allocated 80% of the systems memory, something like 1.5gigs. I was surprised and kind of shocked that a small database made SQL Server allocate so much memory. I do understand that databases should grab as much memory as they can so they can do an efficient job of searching, but isn’t this a little overkill? I’ll post the code if you guys think it’s a problem on my end.

Share this post


Link to post
Share on other sites
Sander    1332
I don't know the internals of MSSQL Server, but I wouldn't be surprised or shocked by *anything* that it does.

Disclosure: Yes. I'm biased. I don't like MSSQL server.

Share this post


Link to post
Share on other sites
MrRage    127
The first Database I spent any serious time with was PostgreSQL, and after that experience I’ve been very disappointed with everything else out there. So I’m a little biased my self, and the only reason why I’m using MsSQL is because it was a system requirement – which I’m trying to have lifted but so far that’s not going to happen.

Share this post


Link to post
Share on other sites
davepermen    1047
It's intended behavior and a good thing. Open up something on the server that needs a lot of ram (like "notepad.exe yourfavouritegigabytebigfile" :)) and you see that sql returns the ram immediately to any other exe that needs it.

Exchange server does the same, as does vista on everything.

What's the use of ram if you don't use it?

Share this post


Link to post
Share on other sites
Kylotan    9996
Linux does the same with file buffers. As long as memory is given back to whatever needs it most - where 'most' is obviously dependent on your particular needs - it's not an issue.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this