MySQL Forums
Forum List  »  InnoDB

Difference between RTRIM and switching from VARCHAR to CHAR and back to VARCHAR
Posted by: Eduardo Koerich Davila
Date: August 25, 2008 03:13PM

What I'm going to post here is something very curious to me. I didn't find an answer yet and was hopping if someone has already faced the same problem.

I was importing a TXT file into my database using fixed length columns, that is, without any separator. At some point I realized that many rows had trailing spaces in many columns and I was wasting space on my storage. So, I thougth, let's change the datatype to VARCHAR and, after importing, UPDATE every row using RTRIM to remove the trailing spaces.

OK, everything went just as expected. I reduced the size of my database, but the diference wasn't that high. For some reason, don't ask me why, I changed the columns back to CHAR and than to VARCHAR again. For my surprise, after that, the database was with half of it's size, without affecting the data inside. I did the same procedure with MyISAM, but the awesome result just ocurred when using InnoDB.

Does anybody know why is that and how can I control this behavior?

Options: ReplyQuote


Subject
Views
Written By
Posted
Difference between RTRIM and switching from VARCHAR to CHAR and back to VARCHAR
2523
August 25, 2008 03:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.