---
url: 'https://metadrop.net/en/articles/get-mysql-table-size-mb-megabytes'
title: 'Get MySQL table size in MB (megabytes)'
author: 'Jorge Tutor'
date: '2017-01-17T09:59:42+00:00'
updated: '2026-06-04T07:45:49+00:00'
type: article
summary: 'Snippet to get the sizes of the tables of a MySQL database.'
tags:
  - MySQL
  - 'Disk size'
  - 'Database tables'
published: true
og:
  determiner: Automatic
  site_name: Metadrop
  'image:alt': 'Get MySQL table size in MB (megabytes)'
  street_address: 'Calle Manuel Luna, 12, 3 Dcha'
  locality: Madrid
  region: Madrid
  postal_code: '28020'
  country_name: España
  email: hola@metadrop.net
  phone_number: '910053180'
schema:
  '@context': 'https://schema.org'
  '@graph':
    -
      '@type': Article
      '@id': 'https://metadrop.net/en/articles/get-mysql-table-size-mb-megabytes#article'
      name: 'Get MySQL table size in MB (megabytes)'
      headline: 'Get MySQL table size in MB (megabytes)'
      description: 'Snippet to get the sizes of the tables of a MySQL database.'
      about:
        - MySQL
        - 'Disk size'
        - 'Database tables'
      datePublished: '2015-01-31T08:00:00+0100'
      dateModified: '2026-06-04T09:45:49+0200'
      author:
        '@type': Person
        name: 'Jorge Tutor'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
      mainEntityOfPage: 'https://metadrop.net/en/articles/get-mysql-table-size-mb-megabytes'
    -
      '@type': Organization
      '@id': 'https://metadrop.net/#organization'
      url: 'https://metadrop.net/'
      name: Metadrop
      sameAs:
        - 'https://www.drupal.org/metadrop'
        - 'https://twitter.com/metadrop'
        - 'https://asociaciondrupal.es/partner/metadrop'
        - 'https://www.linkedin.com/company/metadrop'
      logo:
        '@type': ImageObject
        url: 'https://metadrop.net/themes/custom/mdrop_radix/logo-metadrop-500-500.jpg'
        width: '500'
        height: '500'
    -
      '@type': ItemPage
      '@id': 'https://metadrop.net/en/articles/get-mysql-table-size-mb-megabytes'
      breadcrumb:
        '@type': BreadcrumbList
        itemListElement:
          -
            '@type': ListItem
            position: 1
            name: Home
            item: 'https://metadrop.net/en'
          -
            '@type': ListItem
            position: 2
            name: 'Expert Drupal & Tech Articles'
            item: 'https://metadrop.net/en/articles'
      publisher:
        '@type': Organization
        '@id': 'https://metadrop.net/#organization'
---
 1. [Articles](https://metadrop.net/en/articles)
 
  

# Get MySQL table size in MB (megabytes)

Saturday, January 31, 2015

 

 



Snippet to get the sizes of the tables of a MySQL database.



   



Change the table\_schema "DB\_NAME" with the name of the database you want to analyze.

```sql
SELECT table_name AS "Tables", 
       round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" 
FROM information_schema.TABLES 
WHERE table_schema = "DB_NAME"
ORDER BY (data_length + index_length) DESC;
```



[MySQL](https://metadrop.net/en/articles?text=MySQL)

[Disk size](https://metadrop.net/en/articles?text=Disk%20size)

[Database tables](https://metadrop.net/en/articles?text=Database%20tables)

 

- Jorge Tutor
    
    CIO
 
[Drupal maintenance &amp; support services](https://metadrop.net/en/services/drupal/maintenance " See Drupal maintenance & support services")

Independent, EU-based Drupal maintenance and support keeping mission-critical platforms secure, compliant and evolving — preventive, corrective and evolutive care under one governance model with monthly written reporting.

 

 See more