Are InnoDB tables held in RAM even if they are not frequently queried or at all?
How does MySQL work out which table to hold in memory etc?
For example, if I had 5 tables and all 5 were InnoDB, I query only two of the five tables, will the other three tables still be held in memory?
Top comments (5)
Why do you think they are held in memory? They are not. MySQL stores data on disk. However, there is an in-memory mode, but it is off by default. However, if you enable it, the WHOLE DB will constantly will live in memory, i.e. if it has 3GB of data, you will have 3GB of RAM taken for that. That is from my experience.
Basically I have a 40gb table which is not accessed frequently however, I only have 10gb left of RAM, which made me think that it was holding that table.
Total server RAM is 61GB, AWS Aurora.
Dian Fay may be correct about buffer pool. But I don't think it can take 50 Gb of RAM. Can it be your application that extracts data from DB and holds it in memory? I bet it is, especially if it is not Node.js or PHP app, but persistent daemon-like e.g. Java app.
You want to read about the buffer pool.
Thanks Dian,
I did but I still don’t understand fully.