What Is Buffer Pool in SQL?
- A buffer is an 8-kilobyte page in the server's memory, including indexes and data pages. The buffer pool -- also named the buffer cache -- consists of multiple 8KB buffers. If a user needs the information on one of the buffers, the buffer manager draws it from the pages, rather than contacting the server disk. The pages stay in the pool until the manager needs to store more material in the pool, at which point the pages go back to the disk.
- Database users can change information on the pages in the buffer pool. Users rewriting an individual page do not require the SQL server to rewrite information on the disk immediately. When a page leaves buffer memory and returns to the disk, the server updates the database to take any changes into account. If the information hasn't been rewritten, the database remains the same. Reading from and writing files to the database are the buffer manager's only database operations.
- The buffer manager distributes pages in the buffer pool across the database's hardware at nodes reserved for memory access. Each hardware node holds one SQL node, with the memory available for the cache distributed evenly between the different nodes: If one node has less memory than the others, it will receive a share of foreign memory from the others to balance the workload. The buffer pool treats data in foreign memory and in local memory identically.
- If you study your database's performance, it helps to look at the data stored in the buffer pool. This tells you which pages get accessed most often, which can affect the disk I/O: Pages that don't see much use go back to the disk sooner, increasing the I/O activity. Studying the data also shows you the cumulative effect of queries users direct into the buffer pool, and how they affect the database.