How well do your tables fit in buffer pool

PREVIOUS POST
NEXT 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

PREVIOUS POST
NEXT POST

Comments

  1. Steve Jackson says

    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

  2. Bash99 says

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

Leave a Reply

Your email address will not be published. Required fields are marked *