Table partitioning using 2 columns

你离开我真会死。 提交于 2019-11-28 23:17:48

Bad News: The partition function has to be defined on a single column.

Good News: That single column could be a persisted computed column that is a combination of the two columns you're trying to partition by.

Jonathan

I found this was an easier solution

select ROW_NUMBER() over (partition by CHECKSUM(value,ID) order by SortOrder) as Row From your_table

Natively, no you can not partition by two columns in SQL Server.

There are a few things you could do, have a lookup table that you use to extract which arbitary integer (partition) each value is within, but you only have 1000 partitions maximum, so they are going to start occupying the same space. The computed column approach suffers this same problem, you have a 1k partition limit, chances are you will blow it.

I would probably just stick to a date partition, and range right on the 1st of the month, instead of ranging left on the last part of the month.

What do you intend to gain from the second partition value?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!