skip to Main Content

The table had a great large of data in one field (TEXT type). After some data was removed, the table is still the same size. A lot of data was removed that’s why i’m sure that the table has to be much smaller (about 12GiB).

Maybe is there some cache or anything? How can i know the real size of the table?

I executed the query below in order to know the real size of the table, but it shows me the same size (20GiB) every time.

SELECT
    table_name AS `Table`,
    round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
    information_schema.TABLES
WHERE
    table_schema = "database name" AND table_name = "table name";

2

Answers


  1. Chosen as BEST ANSWER

    I've found an easier way to resolve this problem. I created a new table with the same columns and move data from my old table and after that, remove the old one. That's it.


  2. Run the following to shrink the file size:

    OPTIMIZE TABLE "table-name";
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search