Friday, March 30, 2012
Question(s) about memory management
t
the procedure cache is shrinking at an alarming rate and the buffer cache is
growing. This is surprising to me as this is a proc intensive server and I
know SQL Server dynamically manages the memory. My question is there anyway
to change the amount of memory allocated to the proc cache? I went through
books online, but I only saw things relating to setting the min/max memory
amounts but nothing directly related to the type of management that I'm
wanting to do.this is not bad, your queries are well parameterized and also your SPs,so th
ousands of querys are using the same plan, the problem is when you have a l
arge proc cache and a litle data cache.
--
Mauro
MCTS - SQL Server 2005
"Big Ern" <BigErn@.discussions.microsoft.com> wrote in message news:584554A5-
708A-4F68-924C-94A169B44ED9@.microsoft.com...
I'm monitoring a SQL Server 2000 server running on W2k3 and I'm noticing tha
t
the procedure cache is shrinking at an alarming rate and the buffer cache is
growing. This is surprising to me as this is a proc intensive server and I
know SQL Server dynamically manages the memory. My question is there anyway
to change the amount of memory allocated to the proc cache? I went through
books online, but I only saw things relating to setting the min/max memory
amounts but nothing directly related to the type of management that I'm
wanting to do.
Question(s) about memory management
the procedure cache is shrinking at an alarming rate and the buffer cache is
growing. This is surprising to me as this is a proc intensive server and I
know SQL Server dynamically manages the memory. My question is there anyway
to change the amount of memory allocated to the proc cache? I went through
books online, but I only saw things relating to setting the min/max memory
amounts but nothing directly related to the type of management that I'm
wanting to do.This is a multi-part message in MIME format.
--=_NextPart_000_02CE_01C76B0A.1C9DB110
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
this is not bad, your queries are well parameterized and also your =SPs,so thousands of querys are using the same plan, the problem is when =you have a large proc cache and a litle data cache.
-- Mauro
MCTS - SQL Server 2005
"Big Ern" <BigErn@.discussions.microsoft.com> wrote in message =news:584554A5-708A-4F68-924C-94A169B44ED9@.microsoft.com...
I'm monitoring a SQL Server 2000 server running on W2k3 and I'm =noticing that the procedure cache is shrinking at an alarming rate and the buffer =cache is growing. This is surprising to me as this is a proc intensive server =and I know SQL Server dynamically manages the memory. My question is there =anyway to change the amount of memory allocated to the proc cache? I went =through books online, but I only saw things relating to setting the min/max =memory amounts but nothing directly related to the type of management that =I'm wanting to do.
--=_NextPart_000_02CE_01C76B0A.1C9DB110
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&
this is not bad, your queries are well parameterized and also your SPs,so thousands of querys are using the =same plan, the problem is when you have a large proc cache and a litle data cache.
-- MauroMCTS - SQL Server 2005
"Big Ern"
--=_NextPart_000_02CE_01C76B0A.1C9DB110--sql
Wednesday, March 28, 2012
Question regarding Sql Server memory and cursors
Hello,
We make use of ADO (not ADO.NET) and server-side cursors in one of our products and when viewing Performance Statistics for Sql Server 2005 using Windows Performance Monitor we have noticed that the "Number of active cursor plans" never decreases. In our queries we maintain several open, server-side cursors concurrently. We use .NET/C# and the standard ADO import library. We are closing our recordsets.
The number of active plans jumps by 40 or 50 for each of our queries and as far as we can tell, never decreases (the number of Active Cursors, however, does decrease back to zero.) MSDN/Documentation was somewhat cryptic on what an Active Cursor Plan actually is and Google didn't have any useful information, either.
So, the question is, does this matter? What is an Active Cursor Plan? Is there something other than the recordset and connection that needs to be closed?
Any information or a reference to any useful documentation would be greatly appreciated.
Thanks a lot,
George Kondiles
See this http://blogs.msdn.com/sqlprogrammability/archive/2006/04/27/585170.aspx that says everything.Monday, March 26, 2012
Question regarding C#
I have following questions regarding C# Assembly and Threading.
Let me know the precise answer or lead me to the proper materials.
1. Is memory leakeage possible in .Net Manager Code ?
2. Is memory leakage possible in .Net Unmanaged Code ?
3. How can I find the what % of memory is being used by DLL at run time ?
4. What is difference between Sunchronous processing and Async
processing in .Net ? How can I achieve it ?
5. Can any one lead me towards Multithreading GUI development in Winforms ?
6. Difference between Delegate and Event ?
7. Is there any specific Design Patterns specifically for WinForms ?
Awaiting reply
Thanks
Silent Ocean
Hi
You may want to ask this in one of the microsoft.public.donet.* groups and
not here in the SQL Server one.
Don't multipost as that is the quickest way not to get an answer.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Silent Ocean" <silentocean555@.yahoo.com> wrote in message
news:uuq1s$lkFHA.3936@.TK2MSFTNGP10.phx.gbl...
> Hi All
> I have following questions regarding C# Assembly and Threading.
> Let me know the precise answer or lead me to the proper materials.
> 1. Is memory leakeage possible in .Net Manager Code ?
> 2. Is memory leakage possible in .Net Unmanaged Code ?
> 3. How can I find the what % of memory is being used by DLL at run time ?
> 4. What is difference between Sunchronous processing and Async processing
> in .Net ? How can I achieve it ?
> 5. Can any one lead me towards Multithreading GUI development in Winforms
> ?
> 6. Difference between Delegate and Event ?
> 7. Is there any specific Design Patterns specifically for WinForms ?
> Awaiting reply
> Thanks
> Silent Ocean
sql
Question regarding C#
I have following questions regarding C# Assembly and Threading.
Let me know the precise answer or lead me to the proper materials.
1. Is memory leakeage possible in .Net Manager Code ?
2. Is memory leakage possible in .Net Unmanaged Code ?
3. How can I find the what % of memory is being used by DLL at run time ?
4. What is difference between Sunchronous processing and Async
processing in .Net ? How can I achieve it ?
5. Can any one lead me towards Multithreading GUI development in Winforms ?
6. Difference between Delegate and Event ?
7. Is there any specific Design Patterns specifically for WinForms ?
Awaiting reply
Thanks
Silent OceanHi
You may want to ask this in one of the microsoft.public.donet.* groups and
not here in the SQL Server one.
Don't multipost as that is the quickest way not to get an answer.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Silent Ocean" <silentocean555@.yahoo.com> wrote in message
news:uuq1s$lkFHA.3936@.TK2MSFTNGP10.phx.gbl...
> Hi All
> I have following questions regarding C# Assembly and Threading.
> Let me know the precise answer or lead me to the proper materials.
> 1. Is memory leakeage possible in .Net Manager Code ?
> 2. Is memory leakage possible in .Net Unmanaged Code ?
> 3. How can I find the what % of memory is being used by DLL at run time ?
> 4. What is difference between Sunchronous processing and Async processing
> in .Net ? How can I achieve it ?
> 5. Can any one lead me towards Multithreading GUI development in Winforms
> ?
> 6. Difference between Delegate and Event ?
> 7. Is there any specific Design Patterns specifically for WinForms ?
> Awaiting reply
> Thanks
> Silent Ocean
Question re SQL Server Enterprise Manager
Maybe my memory is wrong, but I sem to recall that it was possible to
configure Enterprise Manager to automatically open to the last DB that I was
using. Also, I seem to recall that this was done via Tools...Options.
Just recently I flattened my PC and did a new install of Windows XP SP2,
Office, VS.Net & SQL Server 2000 Developer Edition. However, since then that
option just isn't there.
The only tabs that appear under Tools...Options are General & Advanced.
Neither of these tabs talk about the above.
Any clues?
Kind regards & Thanks in advance.
Ross Petersen
Tools, Options, Advanced, Startup Options, "Open the console tree to the last active node".
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ross" <Ross@.discussions.microsoft.com> wrote in message
news:5455461A-519D-4716-B6F8-C9D17E2B7D4E@.microsoft.com...
> Hi folks
> Maybe my memory is wrong, but I sem to recall that it was possible to
> configure Enterprise Manager to automatically open to the last DB that I was
> using. Also, I seem to recall that this was done via Tools...Options.
> Just recently I flattened my PC and did a new install of Windows XP SP2,
> Office, VS.Net & SQL Server 2000 Developer Edition. However, since then that
> option just isn't there.
> The only tabs that appear under Tools...Options are General & Advanced.
> Neither of these tabs talk about the above.
> Any clues?
> Kind regards & Thanks in advance.
> Ross Petersen
|||Thanks Tibor
I must be blind!!!
Kind regards
Ross Petersen
"Tibor Karaszi" wrote:
> Tools, Options, Advanced, Startup Options, "Open the console tree to the last active node".
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Ross" <Ross@.discussions.microsoft.com> wrote in message
> news:5455461A-519D-4716-B6F8-C9D17E2B7D4E@.microsoft.com...
>
>
Wednesday, March 21, 2012
Question on SQL Server and the cache
works with sql server (I think Oracle calls it the "Block Buffer")
I fire up sql server
I query a table (ie select * from mytable where myid = 10)
This query's plan ends up in cache?
Do the returned rows end up there too?
Does it matter if myid is an index or not for the cache to utilised?
If the query did not have a where clause, would the entire table end up in
memory?
Sorry for the dumb questions... just trying learn
TIA
> This query's plan ends up in cache?
Maybe. SQL Server caches plans to avoid the compilation costs. However,
trivial plans (probably this one) are not cached since little work is needed
to compile.
> Do the returned rows end up there too?
Data are read into the buffer cache. Execution plans are kept in separate
plan cache.
> Does it matter if myid is an index or not for the cache to utilised?
No.
> If the query did not have a where clause, would the entire table end up in
> memory?
If there is sufficient buffer cache, yes. If not, cache is reused according
to (roughly) a LRU algorithm so that the most recent and frequently accessed
data stay in cache.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dodo Lurker" <none@.noemailplease> wrote in message
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> I'm new to databases and I'm trying to understand how the memory cache
> works with sql server (I think Oracle calls it the "Block Buffer")
> I fire up sql server
> I query a table (ie select * from mytable where myid = 10)
> This query's plan ends up in cache?
> Do the returned rows end up there too?
> Does it matter if myid is an index or not for the cache to utilised?
> If the query did not have a where clause, would the entire table end up in
> memory?
> Sorry for the dumb questions... just trying learn
> TIA
>
|||Some additional information inline...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
> Maybe. SQL Server caches plans to avoid the compilation costs. However, trivial plans (probably
> this one) are not cached since little work is needed to compile.
Check the syscacheobjects table. Cotains one row for each plan. You can see how much a plan has been
reused, type of plan etc.
>
> Data are read into the buffer cache. Execution plans are kept in separate plan cache.
By "Data", Dan is referring to data pages as well as index pages.
>
> No.
>
> If there is sufficient buffer cache, yes. If not, cache is reused according to (roughly) a LRU
> algorithm so that the most recent and frequently accessed data stay in cache.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dodo Lurker" <none@.noemailplease> wrote in message news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
>
|||Thanks guys
Some additional questions
What does the cache hit ratio relate to? The data or the index pages being
in memory? Or both?
By LRU algorithm, you mean the lazy writer process, correct? From my
reading, it seems that this sweeps through and ages out stale queries from
the query cache to make room for new queries. At the same time, does it age
out the data and index pages from their data and index caches that were
generated from the aged out query?
You guys are a great help. I struggle a lot because I'm more of a visual
learner (ie I need to see process flows rather than just read text). I
can't seem to find good material.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> Some additional information inline...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
However, trivial plans (probably
> Check the syscacheobjects table. Cotains one row for each plan. You can
see how much a plan has been[vbcol=seagreen]
> reused, type of plan etc.
>
separate plan cache.[vbcol=seagreen]
> By "Data", Dan is referring to data pages as well as index pages.
>
in[vbcol=seagreen]
according to (roughly) a LRU[vbcol=seagreen]
cache.[vbcol=seagreen]
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...[vbcol=seagreen]
in
>
|||> What does the cache hit ratio relate to? The data or the index pages being
> in memory? Or both?
In perfmon, you have cache hit ration counters for data/index pages as well as for plan pages.
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries from
> the query cache to make room for new queries. At the same time, does it age
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
Yes. Each page has a cost associated. A bit simplified, we can say that each reference to a page
increases the cost by 1. Each time Lazywriter sweeps, the cost for each page decreases by 1. When
cost goes to 0, the page goes in the free list. The algorithm for plan pages is a bit different, but
the same principal applies. So apart for the costing algorithms, data/index pages are handled the
same way as plan pages.
> I
> can't seem to find good material.
I have a feeling that "Inside SQL Server" from MS Press, by Kalen Delaney has some good info on
this.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dodo Lurker" <none@.noemailplease> wrote in message
news:kqSdnZDRD4fItDnenZ2dnUVZ_vidnZ2d@.comcast.com. ..
> Thanks guys
> Some additional questions
> What does the cache hit ratio relate to? The data or the index pages being
> in memory? Or both?
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries from
> the query cache to make room for new queries. At the same time, does it age
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
> You guys are a great help. I struggle a lot because I'm more of a visual
> learner (ie I need to see process flows rather than just read text). I
> can't seem to find good material.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...
> However, trivial plans (probably
> see how much a plan has been
> separate plan cache.
> in
> according to (roughly) a LRU
> cache.
> news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> in
>
sql
Question on SQL Server and the cache
works with sql server (I think Oracle calls it the "Block Buffer")
I fire up sql server
I query a table (ie select * from mytable where myid = 10)
This query's plan ends up in cache?
Do the returned rows end up there too?
Does it matter if myid is an index or not for the cache to utilised?
If the query did not have a where clause, would the entire table end up in
memory?
Sorry for the dumb questions... just trying learn
TIA> This query's plan ends up in cache?
Maybe. SQL Server caches plans to avoid the compilation costs. However,
trivial plans (probably this one) are not cached since little work is needed
to compile.
> Do the returned rows end up there too?
Data are read into the buffer cache. Execution plans are kept in separate
plan cache.
> Does it matter if myid is an index or not for the cache to utilised?
No.
> If the query did not have a where clause, would the entire table end up in
> memory?
If there is sufficient buffer cache, yes. If not, cache is reused according
to (roughly) a LRU algorithm so that the most recent and frequently accessed
data stay in cache.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Dodo Lurker" <none@.noemailplease> wrote in message
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> I'm new to databases and I'm trying to understand how the memory cache
> works with sql server (I think Oracle calls it the "Block Buffer")
> I fire up sql server
> I query a table (ie select * from mytable where myid = 10)
> This query's plan ends up in cache?
> Do the returned rows end up there too?
> Does it matter if myid is an index or not for the cache to utilised?
> If the query did not have a where clause, would the entire table end up in
> memory?
> Sorry for the dumb questions... just trying learn
> TIA
>|||Some additional information inline...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
>> This query's plan ends up in cache?
> Maybe. SQL Server caches plans to avoid the compilation costs. However, trivial plans (probably
> this one) are not cached since little work is needed to compile.
Check the syscacheobjects table. Cotains one row for each plan. You can see how much a plan has been
reused, type of plan etc.
>> Do the returned rows end up there too?
> Data are read into the buffer cache. Execution plans are kept in separate plan cache.
By "Data", Dan is referring to data pages as well as index pages.
>> Does it matter if myid is an index or not for the cache to utilised?
> No.
>> If the query did not have a where clause, would the entire table end up in
>> memory?
> If there is sufficient buffer cache, yes. If not, cache is reused according to (roughly) a LRU
> algorithm so that the most recent and frequently accessed data stay in cache.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dodo Lurker" <none@.noemailplease> wrote in message news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
>> I'm new to databases and I'm trying to understand how the memory cache
>> works with sql server (I think Oracle calls it the "Block Buffer")
>> I fire up sql server
>> I query a table (ie select * from mytable where myid = 10)
>> This query's plan ends up in cache?
>> Do the returned rows end up there too?
>> Does it matter if myid is an index or not for the cache to utilised?
>> If the query did not have a where clause, would the entire table end up in
>> memory?
>> Sorry for the dumb questions... just trying learn
>> TIA
>>
>|||Thanks guys
Some additional questions
What does the cache hit ratio relate to? The data or the index pages being
in memory? Or both?
By LRU algorithm, you mean the lazy writer process, correct? From my
reading, it seems that this sweeps through and ages out stale queries from
the query cache to make room for new queries. At the same time, does it age
out the data and index pages from their data and index caches that were
generated from the aged out query?
You guys are a great help. I struggle a lot because I'm more of a visual
learner (ie I need to see process flows rather than just read text). I
can't seem to find good material.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...
> Some additional information inline...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
> >> This query's plan ends up in cache?
> >
> > Maybe. SQL Server caches plans to avoid the compilation costs.
However, trivial plans (probably
> > this one) are not cached since little work is needed to compile.
> Check the syscacheobjects table. Cotains one row for each plan. You can
see how much a plan has been
> reused, type of plan etc.
>
> >
> >> Do the returned rows end up there too?
> >
> > Data are read into the buffer cache. Execution plans are kept in
separate plan cache.
> By "Data", Dan is referring to data pages as well as index pages.
>
> >
> >> Does it matter if myid is an index or not for the cache to utilised?
> >
> > No.
> >
> >> If the query did not have a where clause, would the entire table end up
in
> >> memory?
> >
> > If there is sufficient buffer cache, yes. If not, cache is reused
according to (roughly) a LRU
> > algorithm so that the most recent and frequently accessed data stay in
cache.
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > "Dodo Lurker" <none@.noemailplease> wrote in message
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> >> I'm new to databases and I'm trying to understand how the memory cache
> >> works with sql server (I think Oracle calls it the "Block Buffer")
> >>
> >> I fire up sql server
> >> I query a table (ie select * from mytable where myid = 10)
> >>
> >> This query's plan ends up in cache?
> >> Do the returned rows end up there too?
> >> Does it matter if myid is an index or not for the cache to utilised?
> >> If the query did not have a where clause, would the entire table end up
in
> >> memory?
> >>
> >> Sorry for the dumb questions... just trying learn
> >>
> >> TIA
> >>
> >>
> >
> >
>|||> What does the cache hit ratio relate to? The data or the index pages being
> in memory? Or both?
In perfmon, you have cache hit ration counters for data/index pages as well as for plan pages.
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries from
> the query cache to make room for new queries. At the same time, does it age
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
Yes. Each page has a cost associated. A bit simplified, we can say that each reference to a page
increases the cost by 1. Each time Lazywriter sweeps, the cost for each page decreases by 1. When
cost goes to 0, the page goes in the free list. The algorithm for plan pages is a bit different, but
the same principal applies. So apart for the costing algorithms, data/index pages are handled the
same way as plan pages.
> I
> can't seem to find good material.
I have a feeling that "Inside SQL Server" from MS Press, by Kalen Delaney has some good info on
this.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dodo Lurker" <none@.noemailplease> wrote in message
news:kqSdnZDRD4fItDnenZ2dnUVZ_vidnZ2d@.comcast.com...
> Thanks guys
> Some additional questions
> What does the cache hit ratio relate to? The data or the index pages being
> in memory? Or both?
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries from
> the query cache to make room for new queries. At the same time, does it age
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
> You guys are a great help. I struggle a lot because I'm more of a visual
> learner (ie I need to see process flows rather than just read text). I
> can't seem to find good material.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...
>> Some additional information inline...
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>> Blog: http://solidqualitylearning.com/blogs/tibor/
>>
>> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
>> news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
>> >> This query's plan ends up in cache?
>> >
>> > Maybe. SQL Server caches plans to avoid the compilation costs.
> However, trivial plans (probably
>> > this one) are not cached since little work is needed to compile.
>> Check the syscacheobjects table. Cotains one row for each plan. You can
> see how much a plan has been
>> reused, type of plan etc.
>>
>> >
>> >> Do the returned rows end up there too?
>> >
>> > Data are read into the buffer cache. Execution plans are kept in
> separate plan cache.
>> By "Data", Dan is referring to data pages as well as index pages.
>>
>> >
>> >> Does it matter if myid is an index or not for the cache to utilised?
>> >
>> > No.
>> >
>> >> If the query did not have a where clause, would the entire table end up
> in
>> >> memory?
>> >
>> > If there is sufficient buffer cache, yes. If not, cache is reused
> according to (roughly) a LRU
>> > algorithm so that the most recent and frequently accessed data stay in
> cache.
>> >
>> > --
>> > Hope this helps.
>> >
>> > Dan Guzman
>> > SQL Server MVP
>> >
>> > "Dodo Lurker" <none@.noemailplease> wrote in message
> news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
>> >> I'm new to databases and I'm trying to understand how the memory cache
>> >> works with sql server (I think Oracle calls it the "Block Buffer")
>> >>
>> >> I fire up sql server
>> >> I query a table (ie select * from mytable where myid = 10)
>> >>
>> >> This query's plan ends up in cache?
>> >> Do the returned rows end up there too?
>> >> Does it matter if myid is an index or not for the cache to utilised?
>> >> If the query did not have a where clause, would the entire table end up
> in
>> >> memory?
>> >>
>> >> Sorry for the dumb questions... just trying learn
>> >>
>> >> TIA
>> >>
>> >>
>> >
>> >
>
Question on SQL Server and the cache
works with sql server (I think Oracle calls it the "Block Buffer")
I fire up sql server
I query a table (ie select * from mytable where myid = 10)
This query's plan ends up in cache?
Do the returned rows end up there too?
Does it matter if myid is an index or not for the cache to utilised?
If the query did not have a where clause, would the entire table end up in
memory?
Sorry for the dumb questions... just trying learn
TIA> This query's plan ends up in cache?
Maybe. SQL Server caches plans to avoid the compilation costs. However,
trivial plans (probably this one) are not cached since little work is needed
to compile.
> Do the returned rows end up there too?
Data are read into the buffer cache. Execution plans are kept in separate
plan cache.
> Does it matter if myid is an index or not for the cache to utilised?
No.
> If the query did not have a where clause, would the entire table end up in
> memory?
If there is sufficient buffer cache, yes. If not, cache is reused according
to (roughly) a LRU algorithm so that the most recent and frequently accessed
data stay in cache.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dodo Lurker" <none@.noemailplease> wrote in message
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> I'm new to databases and I'm trying to understand how the memory cache
> works with sql server (I think Oracle calls it the "Block Buffer")
> I fire up sql server
> I query a table (ie select * from mytable where myid = 10)
> This query's plan ends up in cache?
> Do the returned rows end up there too?
> Does it matter if myid is an index or not for the cache to utilised?
> If the query did not have a where clause, would the entire table end up in
> memory?
> Sorry for the dumb questions... just trying learn
> TIA
>|||Some additional information inline...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
> Maybe. SQL Server caches plans to avoid the compilation costs. However,
trivial plans (probably
> this one) are not cached since little work is needed to compile.
Check the syscacheobjects table. Cotains one row for each plan. You can see
how much a plan has been
reused, type of plan etc.
>
> Data are read into the buffer cache. Execution plans are kept in separate plan ca
che.
By "Data", Dan is referring to data pages as well as index pages.
>
> No.
>
> If there is sufficient buffer cache, yes. If not, cache is reused accordi
ng to (roughly) a LRU
> algorithm so that the most recent and frequently accessed data stay in cac
he.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Dodo Lurker" <none@.noemailplease> wrote in message news:UJednWzblJWP4z7eR
Vn-qA@.comcast.com...
>|||Thanks guys
Some additional questions
What does the cache hit ratio relate to? The data or the index pages being
in memory? Or both?
By LRU algorithm, you mean the lazy writer process, correct? From my
reading, it seems that this sweeps through and ages out stale queries from
the query cache to make room for new queries. At the same time, does it age
out the data and index pages from their data and index caches that were
generated from the aged out query?
You guys are a great help. I struggle a lot because I'm more of a visual
learner (ie I need to see process flows rather than just read text). I
can't seem to find good material.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...
> Some additional information inline...
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:OU8xOqrAGHA.2704@.TK2MSFTNGP15.phx.gbl...
However, trivial plans (probably[vbcol=seagreen]
> Check the syscacheobjects table. Cotains one row for each plan. You can
see how much a plan has been
> reused, type of plan etc.
>
separate plan cache.[vbcol=seagreen]
> By "Data", Dan is referring to data pages as well as index pages.
>
in[vbcol=seagreen]
according to (roughly) a LRU[vbcol=seagreen]
cache.[vbcol=seagreen]
news:UJednWzblJWP4z7eRVn-qA@.comcast.com...[vbcol=seagreen]
in[vbcol=seagreen]
>|||> What does the cache hit ratio relate to? The data or the index pages beingn">
> in memory? Or both?
In perfmon, you have cache hit ration counters for data/index pages as well
as for plan pages.
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries fro
m
> the query cache to make room for new queries. At the same time, does it a
ge
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
Yes. Each page has a cost associated. A bit simplified, we can say that each
reference to a page
increases the cost by 1. Each time Lazywriter sweeps, the cost for each page
decreases by 1. When
cost goes to 0, the page goes in the free list. The algorithm for plan pages
is a bit different, but
the same principal applies. So apart for the costing algorithms, data/index
pages are handled the
same way as plan pages.
> I
> can't seem to find good material.
I have a feeling that "Inside SQL Server" from MS Press, by Kalen Delaney ha
s some good info on
this.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dodo Lurker" <none@.noemailplease> wrote in message
news:kqSdnZDRD4fItDnenZ2dnUVZ_vidnZ2d@.co
mcast.com...
> Thanks guys
> Some additional questions
> What does the cache hit ratio relate to? The data or the index pages bei
ng
> in memory? Or both?
> By LRU algorithm, you mean the lazy writer process, correct? From my
> reading, it seems that this sweeps through and ages out stale queries fro
m
> the query cache to make room for new queries. At the same time, does it a
ge
> out the data and index pages from their data and index caches that were
> generated from the aged out query?
> You guys are a great help. I struggle a lot because I'm more of a visual
> learner (ie I need to see process flows rather than just read text). I
> can't seem to find good material.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:#O8AqUtAGHA.3584@.TK2MSFTNGP14.phx.gbl...
> However, trivial plans (probably
> see how much a plan has been
> separate plan cache.
> in
> according to (roughly) a LRU
> cache.
> news:UJednWzblJWP4z7eRVn-qA@.comcast.com...
> in
>
Friday, March 9, 2012
question on memory
SQL2K Enterprise
I need to set up 1 big fat Disaster Recovery box for my 6 production boxes.
I will do this by putting 6 instances of SQL on the DR box. I know that
there is an 8 gig max (using AWE) limit. But what I don't know is can each
instance have its own 8 gigs, or do all 6 instances need to share the same 8
gigs? Also, would switching to Win2K3 help me to be able to use more RAM?
Basically, I dont want to tell anyone to order 48 gigs or RAM (6 instances
with 8 gigs each) when Im only going to be able to use 8.
TIA, ChrisR
Chris,
Each instance can use it's own block of memory but I don't think Win2K Adv
server can use more than 8GB. I believe you need Data Center for more than
8GB. Certainly for 48GB. Do you need 8GB for each instance? Do each of
the 6 Prod boxes have 8GB now? Does your DR plan say you need to run all 6
instances on the one box at the same time? Seems kind of silly to have 6
individual boxes in prod and expect to run all 6 instances at once on one
box. In any case Win2K3 will not allow you to use any more ram but it does
have certain performance enhancements over 2K that you should take advantage
of.
Andrew J. Kelly SQL MVP
"ChrisR" <noemail@.bla.com> wrote in message
news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
> Win2K Advanced Server
> SQL2K Enterprise
> I need to set up 1 big fat Disaster Recovery box for my 6 production
> boxes. I will do this by putting 6 instances of SQL on the DR box. I know
> that there is an 8 gig max (using AWE) limit. But what I don't know is can
> each instance have its own 8 gigs, or do all 6 instances need to share the
> same 8 gigs? Also, would switching to Win2K3 help me to be able to use
> more RAM? Basically, I dont want to tell anyone to order 48 gigs or RAM (6
> instances with 8 gigs each) when Im only going to be able to use 8.
>
> TIA, ChrisR
>
|||I typed out a reply yesterday but I guess I forgot to hit the reply button.
No I don't need 8 gigs per instance, but 6 boxes sharing 8 gigs wont do
either. Yes, all of them may need to be on at once.
Thanks Andrew.
CR
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23MHGH$jYFHA.1152@.tk2msftngp13.phx.gbl...
> Chris,
> Each instance can use it's own block of memory but I don't think Win2K Adv
> server can use more than 8GB. I believe you need Data Center for more
> than 8GB. Certainly for 48GB. Do you need 8GB for each instance? Do
> each of the 6 Prod boxes have 8GB now? Does your DR plan say you need to
> run all 6 instances on the one box at the same time? Seems kind of silly
> to have 6 individual boxes in prod and expect to run all 6 instances at
> once on one box. In any case Win2K3 will not allow you to use any more
> ram but it does have certain performance enhancements over 2K that you
> should take advantage of.
> --
> Andrew J. Kelly SQL MVP
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
>
question on memory
SQL2K Enterprise
I need to set up 1 big fat Disaster Recovery box for my 6 production boxes.
I will do this by putting 6 instances of SQL on the DR box. I know that
there is an 8 gig max (using AWE) limit. But what I don't know is can each
instance have its own 8 gigs, or do all 6 instances need to share the same 8
gigs? Also, would switching to Win2K3 help me to be able to use more RAM?
Basically, I dont want to tell anyone to order 48 gigs or RAM (6 instances
with 8 gigs each) when Im only going to be able to use 8.
TIA, ChrisRChris,
Each instance can use it's own block of memory but I don't think Win2K Adv
server can use more than 8GB. I believe you need Data Center for more than
8GB. Certainly for 48GB. Do you need 8GB for each instance? Do each of
the 6 Prod boxes have 8GB now? Does your DR plan say you need to run all 6
instances on the one box at the same time? Seems kind of silly to have 6
individual boxes in prod and expect to run all 6 instances at once on one
box. In any case Win2K3 will not allow you to use any more ram but it does
have certain performance enhancements over 2K that you should take advantage
of.
--
Andrew J. Kelly SQL MVP
"ChrisR" <noemail@.bla.com> wrote in message
news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
> Win2K Advanced Server
> SQL2K Enterprise
> I need to set up 1 big fat Disaster Recovery box for my 6 production
> boxes. I will do this by putting 6 instances of SQL on the DR box. I know
> that there is an 8 gig max (using AWE) limit. But what I don't know is can
> each instance have its own 8 gigs, or do all 6 instances need to share the
> same 8 gigs? Also, would switching to Win2K3 help me to be able to use
> more RAM? Basically, I dont want to tell anyone to order 48 gigs or RAM (6
> instances with 8 gigs each) when Im only going to be able to use 8.
>
> TIA, ChrisR
>|||I typed out a reply yesterday but I guess I forgot to hit the reply button.
No I don't need 8 gigs per instance, but 6 boxes sharing 8 gigs wont do
either. Yes, all of them may need to be on at once.
Thanks Andrew.
CR
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23MHGH$jYFHA.1152@.tk2msftngp13.phx.gbl...
> Chris,
> Each instance can use it's own block of memory but I don't think Win2K Adv
> server can use more than 8GB. I believe you need Data Center for more
> than 8GB. Certainly for 48GB. Do you need 8GB for each instance? Do
> each of the 6 Prod boxes have 8GB now? Does your DR plan say you need to
> run all 6 instances on the one box at the same time? Seems kind of silly
> to have 6 individual boxes in prod and expect to run all 6 instances at
> once on one box. In any case Win2K3 will not allow you to use any more
> ram but it does have certain performance enhancements over 2K that you
> should take advantage of.
> --
> Andrew J. Kelly SQL MVP
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
>> Win2K Advanced Server
>> SQL2K Enterprise
>> I need to set up 1 big fat Disaster Recovery box for my 6 production
>> boxes. I will do this by putting 6 instances of SQL on the DR box. I know
>> that there is an 8 gig max (using AWE) limit. But what I don't know is
>> can each instance have its own 8 gigs, or do all 6 instances need to
>> share the same 8 gigs? Also, would switching to Win2K3 help me to be able
>> to use more RAM? Basically, I dont want to tell anyone to order 48 gigs
>> or RAM (6 instances with 8 gigs each) when Im only going to be able to
>> use 8.
>>
>> TIA, ChrisR
>
question on memory
SQL2K Enterprise
I need to set up 1 big fat Disaster Recovery box for my 6 production boxes.
I will do this by putting 6 instances of SQL on the DR box. I know that
there is an 8 gig max (using AWE) limit. But what I don't know is can each
instance have its own 8 gigs, or do all 6 instances need to share the same 8
gigs? Also, would switching to Win2K3 help me to be able to use more RAM?
Basically, I dont want to tell anyone to order 48 gigs or RAM (6 instances
with 8 gigs each) when Im only going to be able to use 8.
TIA, ChrisRChris,
Each instance can use it's own block of memory but I don't think Win2K Adv
server can use more than 8GB. I believe you need Data Center for more than
8GB. Certainly for 48GB. Do you need 8GB for each instance? Do each of
the 6 Prod boxes have 8GB now? Does your DR plan say you need to run all 6
instances on the one box at the same time? Seems kind of silly to have 6
individual boxes in prod and expect to run all 6 instances at once on one
box. In any case Win2K3 will not allow you to use any more ram but it does
have certain performance enhancements over 2K that you should take advantage
of.
Andrew J. Kelly SQL MVP
"ChrisR" <noemail@.bla.com> wrote in message
news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
> Win2K Advanced Server
> SQL2K Enterprise
> I need to set up 1 big fat Disaster Recovery box for my 6 production
> boxes. I will do this by putting 6 instances of SQL on the DR box. I know
> that there is an 8 gig max (using AWE) limit. But what I don't know is can
> each instance have its own 8 gigs, or do all 6 instances need to share the
> same 8 gigs? Also, would switching to Win2K3 help me to be able to use
> more RAM? Basically, I dont want to tell anyone to order 48 gigs or RAM (6
> instances with 8 gigs each) when Im only going to be able to use 8.
>
> TIA, ChrisR
>|||I typed out a reply yesterday but I guess I forgot to hit the reply button.
No I don't need 8 gigs per instance, but 6 boxes sharing 8 gigs wont do
either. Yes, all of them may need to be on at once.
Thanks Andrew.
CR
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:%23MHGH$jYFHA.1152@.tk2msftngp13.phx.gbl...
> Chris,
> Each instance can use it's own block of memory but I don't think Win2K Adv
> server can use more than 8GB. I believe you need Data Center for more
> than 8GB. Certainly for 48GB. Do you need 8GB for each instance? Do
> each of the 6 Prod boxes have 8GB now? Does your DR plan say you need to
> run all 6 instances on the one box at the same time? Seems kind of silly
> to have 6 individual boxes in prod and expect to run all 6 instances at
> once on one box. In any case Win2K3 will not allow you to use any more
> ram but it does have certain performance enhancements over 2K that you
> should take advantage of.
> --
> Andrew J. Kelly SQL MVP
>
> "ChrisR" <noemail@.bla.com> wrote in message
> news:euDyuWiYFHA.2380@.tk2msftngp13.phx.gbl...
>