|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:48 AM
Points: 1,201,
Visits: 2,126
|
|
Hi all
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table and indexes moved into memory?
So any subsequent query against that same table would not need to go to disk at all?
Thanks
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:32 AM
Points: 5,204,
Visits: 11,159
|
|
SQLSACT (9/25/2012) Hi all
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table and indexes moved into memory?
So any subsequent query against that same table would not need to go to disk at all?
Thanks for select * there is no index and yes, all data pages would be cached into memory
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Today @ 10:49 AM
Points: 275,
Visits: 794
|
|
Perry Whittle (9/25/2012)
SQLSACT (9/25/2012) Hi all
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table and indexes moved into memory?
So any subsequent query against that same table would not need to go to disk at all?
Thanksfor select * there is no index and yes, all data pages would be cached into memory
Doesn't it depend on there being space for the whole table in cache?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:32 AM
Points: 5,204,
Visits: 11,159
|
|
laurie-789651 (9/25/2012)
Perry Whittle (9/25/2012)
SQLSACT (9/25/2012) Hi all
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table and indexes moved into memory?
So any subsequent query against that same table would not need to go to disk at all?
Thanksfor select * there is no index and yes, all data pages would be cached into memory Doesn't it depend on there being space for the whole table in cache? yes of course, otherwise spill will happen
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:48 AM
Points: 1,201,
Visits: 2,126
|
|
Perry Whittle (9/25/2012)
laurie-789651 (9/25/2012)
Perry Whittle (9/25/2012)
SQLSACT (9/25/2012) Hi all
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table and indexes moved into memory?
So any subsequent query against that same table would not need to go to disk at all?
Thanksfor select * there is no index and yes, all data pages would be cached into memory Doesn't it depend on there being space for the whole table in cache? yes of course, otherwise spill will happen
Thanks
Spill?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:32 AM
Points: 5,204,
Visits: 11,159
|
|
to TempDB
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 7:48 AM
Points: 1,201,
Visits: 2,126
|
|
Perry Whittle (9/25/2012) to TempDB
Thanks
So if a query is submitted to SQL and the pages need to be brought into memory from disk and there is not enough memory to accomodate those pages, SQL pushes is into tempdb, right?
Does is just push the pages that wouldn't fit in memory into tempdb or does it fulfill the entire transactions pages?
Is this where memory pressure in SQL server comes from?
Thanks
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 10:50 AM
Points: 37,739,
Visits: 30,014
|
|
Perry Whittle (9/25/2012) to TempDB
The buffer pool never spills to TempDB.
If pages are read in from disk for a table and there's not space in the buffer pool, other pages will be removed from it, maybe even pages of the same table that have already been read by the query processor.
What spills to tempDB are sorts, hashes, exchanges, spools (though they're temp structures anyway, so they can't exactly be said to spool). Temp tables will be written to TempDB if necessary
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 10:50 AM
Points: 37,739,
Visits: 30,014
|
|
SQLSACT (9/25/2012) So if a query is submitted to SQL and the pages need to be brought into memory from disk and there is not enough memory to accomodate those pages, SQL pushes is into tempdb, right?
No. If pages are needed in memory and there's not enough space in the buffer pool, other data pages will be removed from the buffer pool to make space. The algorithm that is used to determine which pages to evict is roughly an LRU-2, but there are complexities and cases where pages can be removed from cache immediately after they are read in and used.
It is entirely possible, for a scan of a large table on a server with little memory, for the pages of that table to be read in, the rows on those pages processed by the query processor and then those pages removed from memory to make space for more pages from the same table.
Gail Shaw Microsoft Certified Master: SQL Server 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:32 AM
Points: 5,204,
Visits: 11,159
|
|
thanks I stand corrected
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs"
|
|
|
|