EmergencyEMERGENCY? Get 24/7 Help Now!

How well do your tables fit in buffer pool


Posted on:

|

By:


PREVIOUS POST
NEXT POST
Share Button

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

Share Button
PREVIOUS POST
NEXT POST


Peter Zaitsev

Peter managed the High Performance Group within MySQL until 2006, when he founded Percona. Peter has a Master's Degree in Computer Science and is an expert in database kernels, computer hardware, and application scaling.



Tags:

,

Categories:
MySQL, Percona Software


Comments
  • 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

    Reply

  • Jeffrey Gilbert

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

    Reply

  • 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);

    Reply

  • Bash99,

    Thanks. Great.

    Reply

Leave a Reply

Percona’s widely read Percona Data Performance blog highlights our expertise in enterprise-class software, support, consulting and managed services solutions for both MySQL® and MongoDB® across traditional and cloud-based platforms. The decades of experience represented by our consultants is found daily in numerous and relevant blog posts.

Besides specific database help, the blog also provides notices on upcoming events and webinars.
Want to get weekly updates listing the latest blog posts? Subscribe to our blog now! Submit your email address below and we’ll send you an update every Friday at 1pm ET.

No, thank you. Please do not ask me again.