Caching and inserts on heap tables

Inserts to heap tables take place:

If an insert is the first row on a new page for the table, a clean data buffer is allocated to store the data page, as shown in Figure 2-5. This page starts to move down the MRU/LRU chain in the data cache as other processes read pages into memory.

If a second insert to the page takes place while the page is still in memory, the page is located in cache, and moves back to the top of the MRU/LRU chain.

Figure 2-5: Inserts to a heap page in the data cache

Image shows two inserts in to a heap page. the first takes a clean page from the LRU area and then moves to the back of the line in the MRU area. The second insert finds the page in cache and moves the page back to the beginning of the MRU area.

The changed data page remains in cache until it reaches the LRU end of the chain of pages. The page may be changed or referenced many times while it is in the cache, but it is written to disk only when one of the following takes place:

See Chapter 5, “Memory Use and Performance” in Performance and Tuning Series: Basics.