sys_schema

In case of PostgreSQL

PostgreSQLの場合は、pg_buffercacheをインストールして確認可能。

You can check buffer pool data by using pg_buffercache extention.

postgres=# create extension pg_buffercache;
CREATE EXTENSION


postgres=# \c development
You are now connected to database "development" as user "postgres".
taskleaf_development=# \d
                        List of relations
 Schema |               Name                |   Type   |  Owner   
--------+-----------------------------------+----------+----------
 public | active_storage_attachments        | table    | api
 public | active_storage_attachments_id_seq | sequence | api
 public | active_storage_blobs              | table    | api
 public | active_storage_blobs_id_seq       | sequence | api
 public | ar_internal_metadata              | table    | api
 public | kb                                | table    | api
 public | kb_id_seq                         | sequence | api
 public | pg_buffercache                    | view     | postgres
 public | schema_migrations                 | table    | api

(13 rows)

In case of MySQL

MySQLの場合は、MySQL5.7からDefaultでインストールされているSYS SchemaのViewから確認可能。

You can check cached data in buffer pool by using views in sys schema.

Schema単位でのBuffer Poolの確認

root@localhost [sys]> select * from innodb_buffer_stats_by_schema limit 3;
+---------------+------------+------------+-------+--------------+-----------+-------------+
| object_schema | allocated  | data       | pages | pages_hashed | pages_old | rows_cached |
+---------------+------------+------------+-------+--------------+-----------+-------------+
| APP           | 322.88 MiB | 214.60 MiB | 20664 |          439 |      4040 |      244177 |
| myosm         | 133.88 MiB | 123.04 MiB |  8568 |            0 |      7356 |     1897408 |
| confirm       | 9.47 MiB   | 8.73 MiB   |   606 |            0 |         0 |      130741 |
+---------------+------------+------------+-------+--------------+-----------+-------------+
3 rows in set (0.49 sec)

root@localhost [sys]> 

Table 単位でのBuffer Poolの確認

root@localhost [sys]> select * from innodb_buffer_stats_by_table limit 3;
+---------------+--------------------+------------+------------+-------+--------------+-----------+-------------+
| object_schema | object_name        | allocated  | data       | pages | pages_hashed | pages_old | rows_cached |
+---------------+--------------------+------------+------------+-------+--------------+-----------+-------------+
| APP           | FTS_Tweets         | 201.52 MiB | 132.81 MiB | 12897 |            7 |      1429 |      234034 |
| myosm         | nodetags           | 127.31 MiB | 117.14 MiB |  8148 |            0 |      7542 |     1910389 |
| APP           | FTS_Tweets20200518 | 42.53 MiB  | 38.98 MiB  |  2722 |            0 |         0 |      115510 |
+---------------+--------------------+------------+------------+-------+--------------+-----------+-------------+
3 rows in set (0.63 sec)

root@localhost [sys]> 

Categories:

Tags:

Comments are closed