views:

54

answers:

3

I am using Django with MySql. I have a CharField with max length of 64 as the 2nd to last column, and a Boolean as the last column. Will reversing the order of these provide better optimization of space?

+3  A: 

If at all, probably not significantly enough for you to care about it. MySQL would have some serious work to do if that were the case.

If there is any performance impact (and since I can't seem to find much information on it, probably not), you shouldn't have to worry about it until you hit thousands and thousands of users a day. Column order would be one of the smallest optimizations you would end up making.

Matchu
Well how hard would it be to change when the database has grown to terabytes of data? Would that even be a factor in the difficulty?
Rhubarb
@Rhubarb - I've never, ever heard of anyone making this sort of optimization. If you ever reach the point where you need to, I have faith that you will be at the amazingly professional level to pull it off (though, really, the only difficulty to it would be that it would just take a while).
Matchu
+1  A: 

Rhubarb, in general you never want to change the order of columns once they have been created as you can break a lot of things and cause massive havok in a production system when you try to change a huge table this way.

HLGEM
+1  A: 

It's not a good idea to change the order of columns once they have been defined. When I add new columns to a table, I always add them at the end. This makes it easier if you need to make global changes througout your applications and provides for better documentation since you can easily tell in what order new columns were added. I always comment columns with: date added/changed, description, reason.

Frank Computer