From the course: Advanced SQL for Query Tuning and Performance Optimization

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Improving cache utilization

Improving cache utilization

- [Instructor] Now caching is really important in databases. Caching is a process of storing results of a query so that we can reuse them without having to re-execute a query plan to go and actually get the data for the result sets. Now, the amount of data that we can store or cache is dependent on the size of a data structure called the shared buffers. And in Postgres, Postgres will fill up the shared buffers as much as it can and then it will start to evict data or start deleting data from the cache that it feels is no longer needed. So for example, if it hasn't been used in quite a while if it's the longest of all the query results the one with the longest time since this would last used as a good candidate for evicting or for deleting from the cache. Now, one of the key pieces of information that we can get from our explain plan is the number of hits or the number of times a hit refers to a time where we're able to get…

Contents