Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How well do your tables fit in buffer pool

DZone's Guide to

How well do your tables fit in buffer pool

· Database Zone ·
Free Resource

Download the Altoros NoSQL Performance Benchmark 2018. Compare top NoSQL solutions – Couchbase Server v5.5, MongoDB v3.6, and DataStax Enterprise v6 (Cassandra).

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.
SQL:

1.
mysql> SELECT d.*,round(100*cnt*16384/(data_length+index_length),2) fit FROM (SELECT schema_name,table_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.table_name);
2.
+-------------+---------------------+---------+------------+-------------+--------+
3.
| schema_name | table_name | cnt | sum(dirty) | sum(hashed) | fit |
4.
+-------------+---------------------+---------+------------+-------------+--------+
5.
| db | table1 | 1699133 | 13296 | 385841 | 87.49 |
6.
| db | table2 | 1173272 | 17399 | 11099 | 98.42 |
7.
| db | table3 | 916641 | 7849 | 15316 | 94.77 |
8.
| db | table4 | 86999 | 1555 | 75554 | 87.42 |
9.
| db | table5 | 32701 | 7997 | 30082 | 91.61 |
10.
| db | table6 | 31990 | 4495 | 25681 | 102.97 |
11.
| db | table7 | 1 | 0 | 0 | 100.00 |
12.
+-------------+---------------------+---------+------------+-------------+--------+
13.
7 rows IN SET (26.45 sec)

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.

Download the whitepaper, Moving From Relational to NoSQL: How to Get Started. We’ll take you step by step through your first NoSQL project.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}