【发布时间】:2010-06-07 13:40:47
【问题描述】:
我使用的是 SQL Server 2005。
我有一个表,其行大小应为 124 字节。都是整数或浮点数,没有 NULL 列(所以一切都是固定宽度)。
只有一个索引,聚集。填充因子为 0。
这是表格定义:
create table OHLC_Bar_Trl
(
obt_obh_id int NOT NULL REFERENCES OHLC_Bar_Hdr (obh_id),
obt_bar_start_ms int NOT NULL,
obt_bar_end_ms int NOT NULL,
obt_last_price float NOT NULL,
obt_last_ms int NOT NULL,
obt_bid_price float NOT NULL,
obt_bid_size int NOT NULL,
obt_bid_ms int NOT NULL,
obt_bid_pexch_price float NOT NULL,
obt_ask_price float NOT NULL,
obt_ask_size int NOT NULL,
obt_ask_ms int NOT NULL,
obt_ask_pexch_price float NOT NULL,
obt_open_price float NOT NULL,
obt_open_ms INT NOT NULL,
obt_high_price float NOT NULL,
obt_high_ms INT NOT NULL,
obt_low_price float NOT NULL,
obt_low_ms INT NOT NULL,
obt_volume float NOT NULL,
obt_vwap float NOT NULL
)
go
create unique clustered index idx on OHLC_Bar_Trl (obt_obh_id,obt_bar_end_ms)
插入大量数据后,sp_spaceused 返回以下内容
name rows reserved data index_size unused
OHLC_Bar_Trl 117076054 29807664 KB 29711624 KB 92344 KB 3696 KB
显示的行大小约为 (29807664*1024)/117076054 = 260 字节/行。
剩下的空间在哪里?
是否需要运行一些 DBCC 命令来收紧该表(我无法以正确的索引顺序插入行,所以可能只是内部碎片)?
【问题讨论】:
-
如果您显示实际的列和键(例如,您的聚簇索引是否在唯一的单列主键上?)
-
添加了表定义.....
标签: sql-server