View database objects in Mysql (Summary of SQL commands)

Source: Internet
Author: User

View database objects in Mysql (Summary of SQL commands)
View database objects in Mysql (Summary of SQL commands)
The data objects include tables, views, triggers, and so on. (To View statistics, you must enter the information_schema database)

For example, to view table information, follow these steps:
1. Use the information_schema Database
Use information_schema;

2. query the size of all data (MB ):

Select concat (round (sum (data_length/1024/1024), 2), 'mb') as data_size from tables;

3. view the size of the specified database (schema) (MB ):
Select concat (round (sum (data_length/1024/1024), 2), 'mb') as DB_size from tables where table_schema = 'ehr ';

4. view the size of the specified table in the specified database

Select concat (round (sum (data_length/1024/1024), 2), 'mb') as table_size from tables where table_schema = 'ehr' and table_name = 'ehr _ age ';

Actual production environment: the current UI is more powerful than querying statistics one by one, but the SQL statement is at all!

Related Article

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.