Although I can't remember it, I sometimes share it in my blog to my webmasters who come here to find information about website migration.
Although I can't remember it, I sometimes share it in my blog to my webmasters who come here to find information about website migration.
Not to mention CodeBegin
// For linux tar, decompress tar-zcvf m7766.tar.gz unzip-zxvf/usr/backup/m7766.tar.gz/shell to query the number of tables in the current database: mysql-uroot-pzhushishenme-P3306-BN- e 'show databases; '| grep-v mysql | grep-v information_schema // mysqldump shell export SQLmysqldump-uroot-pzhushishenme-P3306 \ -- quick -- add-drop-table -- order-by-primary \-- complete-insert -- extended-insert = false -- skip-comments \ -- default-character-set = utf8 -- add-locks \ -- databases 7766> dbs/7766c. SQL // mysql <*. SQL // Import mysql-uroot-pzhushishenme-P3306 <7766c. SQL
Shenma? Not enough. let's look at another logical question about mysql optimization. of course, we don't consider data robustness.
// View the total number of items select count (*) from tables; + ---------- + | count (*) | + ---------- + | 536477 | + ---------- + 1 row in set (0.00 sec) // execute the select count (*) from tables where status in (1, 2); + ---------- + | count (*) statement (*) | + ---------- + | 534579 | + ---------- + 1 row in set (1.96 sec) // run the select count (*) from tables where status in () statement of B ); + ---------- + | count (*) | + ---------- + | 1898 | + ---------- + 1 row in set (0.01 sec)
In actual execution, such SQL statements can be optimized logically.
Select count (*) from tables result minus B statement result to get the corresponding result.
Therefore, you need to perform a logical modification to the existing count-related code to optimize the execution efficiency.