I deleted old posts and the database was almost the same size

Asked

Viewed 42 times

2

I have a database with news posted since 2015. I decided to delete the posts, leaving only the last 30 days. With this, I expected the database to reduce in size and this did not happen. Look how I did:

In Phpmyadmin, I downloaded the table, went to the tab to type SQL commands and deleted the records with the command:

DELETE FROM `wp_posts`
WHERE `post_type` = 'post'
AND DATEDIFF(NOW(), `post_date`) > 30

Then I optimized the entire database and lo and behold the database is almost the same size.

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.

1 answer

1

This is how it works and shouldn’t touch it, the space released will be reused, this is a way the database works better, so leave it like this, this optimization will be space, but it will worsen other issues.

If you need to do something you have the command OPTIMIZE TABLE. It is a complex, time-consuming process that needs twice as much space as the DB is occupying now to perform, so if you have this it is because you do not need to perform the operation.

If the setting innodb_file_per_table is off the operation will not work. And change job demand and care.

That goes for Innodb, not Myisam or any other engine.

  • Thank you. It’s a shame it’s like that. You can tell me if it’s possible, via ssh command line, instead of going up a lowered table in . sql, upload an xml from the database? If yes, what would be the command, assuming that the database is called expression_bd and the table expression_bd?

  • This is another question you can ask in https://answall.com/questions/ask. See the [tour] including what you should do with the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.