我有一个巨大的表(几十亿行),它有一个聚簇索引和两个非聚集索引。
BULK INSERT操作产生112000次读取,仅写入383次(持续时间为19948ms)。
这让我非常困惑。为什么读取超过写入?我怎样才能减少它?
更新 查询
insert bulk DenormalizedPrice4 ([DP_ID] BigInt, [DP_CountryID] Int, [DP_OperatorID] SmallInt, [DP_OperatorPriceID] BigInt, [DP_SpoID] Int, [DP_TourTypeID] Int, [DP_CheckinDate] Date, [DP_CurrencyID] SmallInt, [DP_Cost] Decimal(9,2), [DP_FirstCityID] Int, [DP_FirstHotelID] Int, [DP_FirstBuildingID] Int, [DP_FirstHotelGlobalStarID] Int, [DP_FirstHotelGlobalMealID] Int, [DP_FirstHotelAccommodationTypeID] Int, [DP_FirstHotelRoomCategoryID] Int, [DP_FirstHotelRoomTypeID] Int, [DP_Days] TinyInt, [DP_Nights] TinyInt, [DP_ChildrenCount] TinyInt, [DP_AdultsCount] TinyInt, [DP_TariffID] Int, [DP_DepartureCityID] Int, [DP_DateCreated] SmallDateTime, [DP_DateDenormalized] SmallDateTime, [DP_IsHide] Bit, [DP_FirstHotelAccommodationID] Int) with (CHECK_CONSTRAINTS)
没有触发器&外键 DP_ID的群集索引 和两个非唯一索引(fillfactor = 90%)
另外还有一个DB存储在RAID50上,条带大小为256K
答案 0 :(得分:2)
对于您插入的每一行,数据库必须:
这些活动可能会导致大量读取,并且必须为每一行完成这些操作。因此,查看单行插入的数百个读取是完全正常的。事实上,我认为数据库正在发挥作用是一个健康的信号。