HACKER Q&A
📣 askingone

Are databases implementing own memory paging (swaping)?


Are (any or all?) database systems engines implementing own memory paging (memory swaping mechanisms) beside just what Operating System is providing so they can still work even when memory available trough OS virtual memory is exhausted? Or in other words - so they could work on data sets far exceeding size of memory that virtual memory can provide?


  👤 outsidein Accepted Answer ✓
Most DB systems allocate memory pools for specific purposes, and do a better job in managing RAM vs OS because the DB knows which queries will be processed and can optimize RAM usage accordingly. Using virtual memory (paged out to disk) would spoil the DB optimizations and should be avoided in general.

But the more important part is managing disk IO, as permanent storage is far slower, but magnitudes larger than RAM (except for memory DBs which depend on special RAM with battery backup). Even in times of SSD.

This applies for dedicated DB servers.

If you have a server with mixed workloads and other apps beside DB, it becomes blurry.