简体   繁体   English

是否可以在SQL Server中进行列分区

[英]Is it possible to column partitioning in SQL Server

The size of each record of table is a performance parameter. 表的每个记录的大小是性能参数。 that means if size of record was small SQL Server fetch more records in each read from physical hard. 这意味着如果记录的大小很小,则SQL Server每次从物理硬盘读取时都会获取更多的记录。

In most of our queries we not use all column of table, and may be some column use only in specific query. 在大多数查询中,我们不使用表的所有列,而可能仅在特定查询中使用某些列。 Is it possible for we partitioning columns of each table to have better performance. 我们对每个表的列进行分区是否可能具有更好的性能。

I use SQL Server 2008 R2. 我使用SQL Server 2008 R2。

Thank you. 谢谢。

True column level partitioning comes with column oriented storage, see Inside the SQL Server 2012 Columnstore Indexes , but that is available only in SQL Server 2012 and addresses specific BI workloads, not general SQL Server apps. 真正的列级分区随附于面向列的存储,请参阅“ SQL Server 2012列存储索引内部” ,但这仅在SQL Server 2012中可用,并且可以解决特定的BI工作负载,而不是常规的SQL Server应用程序。

In row oriented storage the vertical partitioning is actually another name for designing proper covering indexes. 在面向行的存储中,垂直分区实际上是设计适当的覆盖索引的另一个名称。 If the engine has an alternative narrow index it will use it instead of the base table, when possible. 如果引擎具有替代的窄索引,则在可能的情况下将使用它而不是基表。

The last alternative, manually splinting the table and joining the vertical 'shards' in queries (or defining joining views, same thing) is usually ill advised and seldom pays off. 最后一种选择是手动建议将表夹板并在查询中联接垂直的“分片”(或定义联接视图,同样的事情),通常是不明智的,而且很少能得到回报。

At the moment with SQL Server 2008, you cannot partition tables horizontally. 目前,使用SQL Server 2008时,无法对表进行水平分区。 If you have a large number of columns, you would need to chop it into horizontal chunk tables that share a common key and then skin them with an update-able view to give the illusion of one very wide table. 如果您有大量的列,则需要将其切成共享公共键的水平块表,然后使用可更新的视图对它们进行换肤,以产生一个非常宽的表的错觉。

If there are just a few large columns (eg VARCHAR(1000) ), you can normalize your data into unique value tables. 如果只有几个大列(例如VARCHAR(1000) ),则可以将数据标准化为唯一的值表。

The one exception to the no column partitioning rule are character columns declared as max (varchar(max), for example). 无列分区规则的一个例外是声明为max的字符列(例如,varchar(max))。

These are stored on a separate data page. 这些存储在单独的数据页上。 I believe this page is not read in unless the column is referenced in the query. 我相信除非查询中引用了该列,否则不会读入此页面。 If I am wrong, I'am sure more knowledge people will correct me. 如果我错了,我相信会有更多的知识人会纠正我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM