Because of a bug i had inserted a LOT of rows in one table. I deleetd the rows but my db is >1gb instead of being 200mb. How do i vaccumm it? I trid optimizing the table. It didnt shrink the size. Am i stuck with this huge mysql file?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create an identical table structure,
select * into newtable from oldtablethendrop oldtablethenalter table newtable rename oldtable. The quickest cross-platform way.(In mysql you can use
rename table newtable to oldtable, but that’s not standard sql.)One caveat, this only works if mysql is set up to be one file per table, which is the default AFAIK, but it can also be set up to be all tables in one file. If it’s set up that way, you’ll have to clone the entire database, a much more significant undertaking. If you have a single “ibdata” file, you have all tables in one file, and you should probably see this answer.