SQL Server分区表,能否按照多个列作为分区函数的分区依据(转载)

问:


Hi,

I have a table workcachedetail with 40 million rows which has 8 columns.We decided to partition the table.Most of the queries in our environment uses 4 columns in the where clause or joins.If I partition the table with 4 columns then I may get better performance.Can we partition the table on multiple columns(like partitioning on id,deptid,designation)?

Thanks,

答:


no

You can partition by creating a persisted computed columns.

https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-table-computed-column-definition-transact-sql

意思就是,目前SQL Server还不支持将多个列作为分区函数的分区依据,只能用一列作为分区函数的分区依据,但是我们可以将多个列构造为一个计算列(computed columns)来作为分区依据。

参考文献:

how to partition a table on multiple columns

原文地址:https://www.cnblogs.com/OpenCoder/p/10987270.html