1
搜寻,然后您应扫描…在分区表上
我已经在Itzik Ben-Gan的 PCMag中阅读了这些文章: 搜寻并您应扫描第一部分:当优化程序未优化 搜寻时,您应扫描第二部分:升序键 我目前所有分区表都遇到“最大分组”问题。我们使用Itzik Ben-Gan提供的技巧来获取max(ID),但有时它无法运行: DECLARE @MaxIDPartitionTable BIGINT SELECT @MaxIDPartitionTable = ISNULL(MAX(IDPartitionedTable), 0) FROM ( SELECT * FROM ( SELECT partition_number PartitionNumber FROM sys.partitions WHERE object_id = OBJECT_ID('fct.MyTable') AND index_id = 1 ) T1 CROSS APPLY ( SELECT ISNULL(MAX(UpdatedID), 0) AS IDPartitionedTable FROM fct.MyTable s WHERE $PARTITION.PF_MyTable(s.PCTimeStamp) = …