相关疑难解决方法(0)

SQL Server 索引与统计

之间有什么区别CREATE INDEXCREATE STATISTICS何时该使用的呢?

index sql-server statistics

14
推荐指数
1
解决办法
1万
查看次数

统计数据。多列直方图可能吗?

我正在考虑一种情况,我有两个高密度的列,但这些列不是独立的。

定义

这是我为测试目的而创建的表的定义。

CREATE TABLE [dbo].[StatsTest](
    [col1] [int] NOT NULL,  --can take values 1 and 2 only
    [col2] [int] NOT NULL,  --can take integer values from 1 to 4 only
    [col3] [int] NOT NULL,  --integer. it has not relevance just to ensure that each row is different
    [col4]  AS ((10)*[col1]+[col2])  --a computed column ensuring that if two rows have different values in col1 or col2 have different values in col4 
) ON [PRIMARY]
Run Code Online (Sandbox Code Playgroud)

数据

实验数据如下

col1    col2    col3    col4
1 …
Run Code Online (Sandbox Code Playgroud)

sql-server statistics

13
推荐指数
1
解决办法
1507
查看次数

标签 统计

sql-server ×2

statistics ×2

index ×1