How it works...
The first part of this recipe has two steps. We could perform this work at any time, so the table may have existed from our previous work. Therefore, the first step is to drop the active_snap table. None of the steps following this one remove this table, because, in the case of a crash, we want its contents as a starting point for restoring the cache contents.
After dropping the active_snap table, we recreate it with the top 20 tables and top 20 indexes, which are sorted by how often they're used in SELECT statements. This is only a close approximation based on the collected database statistics, but it's better than leaving the data entirely uncached.
After creating the list of the most accessed tables and indexes, we have ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access