开发者

How to use a wildcard in defining boundaries when partitioning a table in SQL 2008?

开发者 https://www.devze.com 2023-02-19 20:08 出处:网络
I have several million records in a table (book/media data) and I would like to partition the table using their ISBN numbers. However, I\'d like to partition them by only using the last 3 digits of th

I have several million records in a table (book/media data) and I would like to partition the table using their ISBN numbers. However, I'd like to partition them by only using the last 3 digits of the numbers.

*000 *001 *002...*999

This divides up everything I want into neat, smaller/more usable sections of data since the books/开发者_如何学JAVAmedia stored in there will be limited in numbers. So select/inserts will always (according to me) be relatively fast.

The problem now is, using the wizard, I can't figure out how to use a wildcard in the "Boundary" section when defining the function.

Is this possible?


You cannot. That would be hash partitioning and is not supported by SQL Server. What you can do instead is add a computed persisted column that retains the last 3 digits of the ISBN and partition by the persisted computed column.

As a side note, adding 1000 partitions to SQL Server 2008 R2 will make queries rather (very) slow on that table. Partitioning is never an option for better performance, the best result you can hope for is no regression from a non-partitioned table.

0

精彩评论

暂无评论...
验证码 换一张
取 消