From the course: Oracle Database 12c: Administration

Buffer cache - Oracle Database Tutorial

From the course: Oracle Database 12c: Administration

Start my 1-month free trial

Buffer cache

- [Instructor] Moving along with our grand tour of the SGA, now it's time to talk about the database buffer cache. Alongside the shared pool, it's one of the most important components of the SGA. Unlike the shared pool, which caches parsed SQL statements and database method data, the buffer cache is responsible for actually caching database user data. Rows from tables. Why? As always, performance, performance, performance. When a user runs a SQL statement, if the data is read from disk, performance will suffer, as disks, no matter how fast they are, will always be slower than RAM, than memory. If the user can get the data required for the SQL statement directly from memory, performance will increase tremendously. That's why caching data in memory is so important, and for that specific purpose, we have the buffer cache area inside the SGA. The buffer cache caches frequently accessed database data into memory, so that performance can benefit. It's important to note that the buffer cache actually caches blocks of data instead of individual rows. The way that Oracle stores our data physically on disk is different compared to how we logically structure our database. We work with tables and rows, but Oracle stores it as chunks of sequential data known as Oracle blocks. Each Oracle block contains one or more rows for any given table. Each time a user session accesses a row, the entire block is read and cached in the buffer cache. By default, an Oracle database block is eight kilobytes in size, but we can change that. And also don't worry. We will talk about the physical properties of Oracle database storage later in our course. It's important to note that Oracle is smart enough to make sure blocks which are loaded into the buffer cache always satisfy the database read consistency model. All users who are concurrently connected to the database share and access a single database buffer cache, having access to a single unified view of all cache database data. Another important note is that Oracle automatically manages which data is cached into the buffer cache. Because RAM is a limited resource, Oracle makes sure that only the most frequently read data from disk will be cached into memory, and data that is seldom accessed will eventually be aged out of the buffer cache so that it will make room for more frequently accessed data. Similarly to the way that the shared pool is divided into multiple subcaches, inside the buffer cache we also find it divided into subcomponents, including the keep pool, recycle pool, as well as others. Those individual subcaches are beyond the scope of our course. For now, it is sufficient for us to talk about one of these components only, and that is the keep pool. The keep pool is a component inside the buffer cache which allows a database administrator to pin certain sets of data into memory and make sure that they never age out of the cache, even if they are seldom accessed.

Contents