Where the open source database community meets: Use code PERCONA75 and secure your spot for Percona Live.  Register

How well do your tables fit in buffer pool

March 26, 2010
Author
Peter Zaitsev
Share this Post:

In XtraDB we have the table INNODB_BUFFER_POOL_PAGES_INDEX which shows which pages belong to which indexes in which tables. Using thing information and standard TABLES table we can see how well different tables fit in buffer pool.

You can also see in one of the cases the value shown is a bit over 100% – I am not sure where it comes from but more pages reported to belong to the table in buffer pool than on disk. Though it seems to work well enough for estimation purposes.

UPDATE: We have changed the Schema in newer Percona Server versions and this exact query will no more work. The correct query is described in this post

0 0 votes
Article Rating
Subscribe
Notify of
guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Jeffrey Gilbert
Jeffrey Gilbert
16 years ago

That is awesome. Wish I had this sort of feature back in the day.

Bash99
Bash99
16 years ago

a generic version work with partitions

SELECT d.*,round(100*cnt*16384/(data_length+index_length),2) fit
FROM (SELECT schema_name,
replace(substring_index(table_name, ‘#’, 3), ‘#mysql50#’, ”) as xtable_name,
substring_index(table_name, ‘#’, -1) as partition_name,
count(*) cnt,sum(dirty),sum(hashed)
FROM INNODB_BUFFER_POOL_PAGES_INDEX GROUP BY schema_name,table_name
ORDER BY cnt DESC LIMIT 20) d JOIN TABLES
ON (TABLES.table_schema=d.schema_name AND TABLES.table_name=d.xtable_name);

Steve Jackson
Steve Jackson
16 years ago

Peter, this query does not work on 5.5

INNODB_BUFFER_POOL_PAGES_INDEX no longer contains schema_name column, so query fails on this.

Do you have an updated version of the same query, but for rel 5.5?

Cheers

//Steve

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved