How does MySQL calculate the number of opened files _ MySQL

Source: Internet
Author: User
How does MySQL calculate the number of opened files bitsCN.com?

I. test
We can see from the manual "6.4.8. How MySQL Opens and Closes Tables" that every time a MyISAM table is opened, we need two file descriptors for verification.
1. restart mysqld
/Etc/init. d/mysql restart
2. check that several files are opened.

Lsof | grep/home/mysql
...
Mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009/home/mysql. sock
Mysqld 24349 mysql 6u REG 2048 30425188/home/mysql/host. MYI
Mysqld 24349 mysql 7u REG 8, 33 0 30425189/home/mysql/host. MYD
Mysqld 24349 mysql 8u REG 2048 30425153/home/mysql/user. MYI
Mysqld 24349 mysql 9u REG 8, 33 892 30425155/home/mysql/user. MYD
Mysqld 24349 mysql 10u REG 8, 33 5120 30425126/home/mysql/db. MYI
Mysqld 24349 mysql 11u REG 3080 30425148/home/mysql/db. MYD
Mysqld 24349 mysql 12u REG 8, 33 4096 30425154/home/mysql/tables_priv.MYI
Mysqld 24349 mysql 13u REG 8, 33 0 30425157/home/mysql/tables_priv.MYD
Mysqld 24349 mysql 14u REG 8, 33 4096 30425143/home/mysql/columns_priv.MYI
Mysqld 24349 mysql 15u REG 8, 33 0 30425156/home/mysql/columns_priv.MYD
Mysqld 24349 mysql 16u REG 8, 33 4096 30425127/home/mysql/procs_priv.MYI
Mysqld 24349 mysql 17u REG 8, 33 0 30425136/home/mysql/procs_priv.MYD
Mysqld 24349 mysql 18u REG 8, 33 1024 30425173/home/mysql/servers. MYI
Mysqld 24349 mysql 19u REG 8, 33 0 30425174/home/mysql/servers. MYD
Mysqld 24349 mysql 20u REG 8, 33 2048 30425182/home/mysql/event. MYI
Mysqld 24349 mysql 21u REG 8, 33 0 30425183/home/mysql/event. MYD
...
  
We can see that a total of eight tables are opened, and each table has two file descriptors, which seems to be correct.
3. check the status result again.

Mysql> show global status like 'open _ % ';
+ ------------------------ + ------- +
| Variable_name | Value |
+ ------------------------ + ------- +
| Open_files | 17 |
| Open_streams | 0 |
| Open_table_definitions | 15 |
| Open_tables | 8 |
| Opened_files | 52 |
| Opened_tables | 15 |
+ ------------------------ + ------- +

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.