We have a number of projects big and small - most (if not all) of them use at least one SQL Server DB. All of them have different environments set up. Typically: dev (1+), QA, UAT, Live. It is also common for us to release various code updates to different environments independently of each other. Naturally some of those updates come with schema update scripts such as
alter table foo add column bar
go
update foo set bar=... where ...
Sometimes made by hand, other times using Red Gate SQL/Data Compare.
Anyway where I'm going with this is that often different environments for the same project end up with different order of columns. Is this a problem? I don't really know... Does column order have any performance implications? Anything I could be missing?
In a relation, the order of the columns does not matter.
Generally, no, the order of the tables in the JOIN will not affect the overall results of the query. As long as you specify what columns to select, the results should appear essentially the same, just that the rows will be ordered according to the appearance in the first table.
No, the order of the WHERE clauses does not matter. The optimizer reviews the query & determines the best means of getting the data based on indexes and such.
No, column order is not significant. In actuality, the order that column data is stored on disk may itself be different than the order you see in client tools, as the engine reorders the data to optimize storage space and read/write performance (putting multiple bit fields into a single memory location, aligning columns on memory boundaries, etc.. )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With