I support an application with a table with a
LONGTEXT column. (We actually support multiple DBMSes, but for the purposes of this question, I am asking about MySQL.)
As it turns out, the data in that column comprises a very large chunk of the total usage in the entire database (about 40%!), and that data is simply debugging information anyways.
Now, we want to keep the last month of debug data around, so we can't drop the column entirely, so I assume we can free up space by updating older rows to
- When I set the values of that column to
NULL, does it actually delete the data? I know that
LONGTEXTdata is stored separately from the rest of the table. Are the now-orphaned entries "garbage-collected" or otherwise cleaned up at some point?
- If this doesn't happen automatically, what do I need to do to trigger a cleanup?
- Once the data is actually deleted, will that space be reclaimed by the OS/filesystem, or will it remain claimed by the database? If we wanted to release the space back to the filesystem (so we can pay for a smaller hosted instance), how would we go about releasing that space?