1

I know in Postgres, we can explicitly load a table into the cache using pg_prewarm extension, is there a similar mechanism/UDF/etc in MySQL? I know MySQL would cache data in shared buffer implicitly, but is there a way to explicitly do so? Thanks!

1 Answers1

2

Not quite the same thing, but see innodb_buffer_pool_dump_at_shutdown as a way of somewhat quickly getting back to where you left off after a shutdown. It saves pointers to blocks, so shutdown is not slowed significantly.

A crude alternative is to do something like SELECT AVG(col) FROM tbl where col is not indexed. However, if the table is bigger than the buffer_pool, be aware that some of the cached data will be pushed out before the query is finished.

Rick James
  • 80,479
  • 5
  • 52
  • 119