i'm faced with having to add 64 new columns to table that already had 32 columns. For examples sake:
Customers
(
CustomerID int
Name varchar(50)
Address varchar(50)
City varchar(50)
Region varchar(50)
PostalCode varchar(50)
Country varchar(2)
Telephone varchar(20)
...
NewColumn1 int null
NewColumn2 uniqueidentifier null
NewColumn3 varchar(50)
NewColumn4 varchar(50)
...
NewColumn64 datetime null
...
CreatedDate datetime
LastModifiedDate datetime
LastModifiedWorkstation varchar(50)
LastModifiedUser varchar(50)
)
Most of the time the majority of these new columns will contain null
.
It is also a given that if i vertically partition off these 64 new columns into a new table, then every time i SELECT
from Customers:
SELECT ...
FROM Customers
will have to be converted to a join to get the partitioned values (i.e. there is never a performance gain to be had where i don't require the new columns):
SELECT ...
FROM Customers
INNER JOIN Customers_ExtraColumns
ON Customers.CustomerID = Customers_ExtraColumns.CustomerID
So that's one con to partitioning off the columns.
The other con is that i have to manage inserting rows into two tables simultaneously, rather than just one.
The final con i can think of is that SQL Server now has to perform an INNER JOIN
any time i want to access "Customers". There will now and forever a waste of CPU and I/O to join tables that really are one table - except that i had decided to split them up.
So my question is: why would i split them up?
Is there any value in vertically partitioning out 64 columns to a separate table when they will mostly be null? Null take up very little space....
What are the pros?
Edit: Why am i even considering partitioning? It's mostly null data that will triple the number of columns in the table. Surely it must be bad!