Search code examples
databasedatabase-design

Is there a best practice to database column ordering?


Are there any best practices to column ordering when designing a database? Will order effect performance, space, or the ORM layer?

I am aware of SQL Server - Does column order matter?. I am looking for more general advice.


Solution

  • I don't believe that the column order will necessarily affect performance nor space. To improve performance, you can create indexes on the table, and the order of the columns defined in the index will effect performance.

    I've seen tables have their fields ordered alphabetically, as well as "logically" (in a way that makes sense for the data that is being represented). All in all, I can see benefits in both, but I would tend to go for the "logically" method.