FIX: ????? ??? ??? ????? ??????? ?? SQL Server 2005: "?? ???? ????? ?? ???????? ??????? ?? ???? <tablename>?? ???? ???? <indexname>"

?????? ????????? ?????? ?????????
???? ???????: 937533 - ??? ???????? ???? ????? ????? ??? ???????.
???: # 50001287 (??????? ?????? SQL)
????? ???? | ?? ????

?? ??? ??????

???????

?? SQL Server 2005 ????? ????? ????? ??????? ??? ????? ???????:
2601 ???: ???????: ???? 14 ?: 1
?? ???? ????? ?? ???????? ??????? ?? ???? TableName ?? ???? ???? IndexName.
???? ??? ??????? ????? ????? ??? ??????? ???? ?? ?????? ????????? ??? ???? ????? ??????? ???? ????? ??? ???? ?? 2,147,483,648 ?????? ???????.

?????

???? ??? ??????? ????? ??? ???? ????? ??????? ???? ????? ???? ?????? ???????? ???? ??? ???? ??? ????? ??? ????? ?????????. ????? ?????? ??? ?????? ??????? 2,147,483,648 ? ???? uniquifier ???? ?????? ????????. ?????? ???? ????? ??? ???? ??? ??? ?? ???? ????? ???? ?????.

????

??????? ??????? ????????

?? ????? ??????? ????? ???? ??????? ????? ?? ??????? ???????? 2. ????? ?? ????????? ??? ????? ?????? ??? ???? ??????? ???????? ??? ?? SQL Server 2005 ?????? ????? ?????? SP2 ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
936305???? ??????? ???????? 2 SQL Server 2005 ?????? ????? ?????? SP2
?????? ??? ????????? ???????? ????? ?? ????? ????? ???? ???? ????????? ??????? ????? ???? ??????? ?????? ???? ?? ??????? ?? SQL Server 2005 ??????? ???????. ???? Microsoft ?????? ????? ???? ????? ??????? ???? ????? ??? ??? ??????? ??????. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
937137???? SQL Server 2005 ???? ?? ??????? ??? ????? SQL Server 2005 ?????? ????? ?????? SP2
??? ????? ????????? ??????? Microsoft SQL Server 2005 ??? ???? SQL Server ?????. ??? ????? ??????? ???? SQL Server 2005 ?????? ????? ?????? SP2 ??? ????? SQL Server 2005 ?????? ????? ?????? SP2. ???? ???????? ??? ????? ????????? ??????? ???????? ?? ???? ???? ?? SQL Server ?? ???? ???? ?? SQL Server ???????.

???? ??????

??????? ?????? ??? ??? ??????? ?????? ???? ????? ??????? ????? ???? ????? ??????? ????.

?????? ??????? ????? ??????? ??????? ??????? ?? ??? "????? ????? ????? ??? ???????" ?? ??? "???? ?? ?????????" ????? ?????? ?? ????.
  • ??????? ????????? ????? ? ??? ????? ?? ????????? ??????.

    ??? ???? ??????? ?? ??????? ?????? ?? ??? "???? ?? ?????????" ????? ????????? ??? ????? ??? ???:
    --Part 1
    select t1.c1,sum(t2.c3)
    from t1 
    inner join t2 on t1.c1=t2.c1
    group by t1.c1
    --Part 2
    select t1.c1 , count(distinct t1.c3)
    from t1 
    inner join t2 on t1.c1=t2.c1
    group by t1.c1
    
  • ?????? ???? ????:
    1. ????? ???? ????.
    2. ????? ?????? ???? ????? ??? ????? ?? ?????? ??????.
    3. ?? ????????? ????? ?????? ??????.
  • ???? ??????? ??? ??????? ????????? ?? ??????? ?????? ?????? ??? ????? ????? ?????????. ????? ?????? ??? ????? ????? ???? ????? ??????? ????.

?????

???? Microsoft ?? ??? ????? ?? ?????? Microsoft ??????? ?? ??? "????? ???".

??????? ????

???? ??? ??????? ?????? ??? ?? ???? ????? ?? ??? ??????? ?? ??? ????? ??? ?????? ?? ??? ??????. ??? ????? ??? ??????? ?????? ???? ????? ????? ??????? ??? ?????? ??? ???????:
?? ????? ???? ?????? ??? ?????? ???? ????? ?????? ????? ????? ?? ???? ????? ? PartitionID ?. ????? ?? ????? ????? ?????? ?? ?? ???; ????? ?????? ????? ????? ????? ???.

????? ????? ????? ??? ???????

  1. ??? Studio ????? ???? SQL ?? ?? ?????? ??? ???? SQL Server 2005.
  2. ?? ?????? ??????? ???? ?? ?? ?????? ???????? ???????:
    if exists(select name from sysobjects where name=N't1' and xtype='U')
    drop table t1
    go
    create table t1
    ( c1 bigint identity,
    c2 char (10),
    c3 int ,
    c4 int)
    go
    
    if exists(select name from sysobjects where name=N't2' and xtype='U')
    drop table t2
    go
    create table t2
    ( c1 bigint identity,
    c2 char (10),
    c3 int ,
    c4 int)
    go
    
  3. ????? ???????? ???????:
    set showplan_all on
    go
    select t1.c1,sum(t2.c3), count(distinct t1.c3)
    from t1 
    inner join t2 on t1.c1=t2.c1
    group by t1.c1
    go
    
    set showplan_all off
    go
    
When you complete these steps, you receive the following execution plan:
StmtText                                                                                                                                                                              StmtId      NodeId      Parent      PhysicalOp                     LogicalOp                      Argument                                                                                                                              DefinedValues                                                                           EstimateRows  EstimateIO    EstimateCPU   AvgRowSize  TotalSubtreeCost OutputList                                                                                          Warnings Type                                                             Parallel EstimateExecutions
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- ----------- ----------- ------------------------------ ------------------------------ ------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- ------------- ------------- ------------- ----------- ---------------- --------------------------------------------------------------------------------------------------- -------- ---------------------------------------------------------------- -------- ------------------
select t1.c1,sum(t2.c3), count(distinct t1.c3)
from t1 
inner join t2 on t1.c1=t2.c1
group by t1.c1                                                                                1           1           0           NULL                           NULL                           1                                                                                                                                     NULL                                                                                    1             NULL          NULL          NULL        0.06636031       NULL                                                                                                NULL     SELECT                                                           0        NULL
  |--Compute Scalar(DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]))                                                                                                         1           2           1           Compute Scalar                 Compute Scalar                 DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1])                                                                              [Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]                                         1             0             1E-07         23          0.06636031       [Test2].[dbo].[t1].[c1], [Expr1008], [Expr1009]                                                     NULL     PLAN_ROW                                                         0        1
       |--Merge Join(Inner Join, MANY-TO-MANY MERGE:([Test2].[dbo].[t1].[c1])=([Test2].[dbo].[t1].[c1]), RESIDUAL:([Test2].[dbo].[t1].[c1] = [Test2].[dbo].[t1].[c1]))                1           3           2           Merge Join                     Inner Join                     MANY-TO-MANY MERGE:([Test2].[dbo].[t1].[c1])=([Test2].[dbo].[t1].[c1]), RESIDUAL:([Test2].[dbo].[t1].[c1] = [Test2].[dbo].[t1].[c1])  NULL                                                                                    1             0.000313      0.00564738    23          0.06636021       [Expr1008], [Expr1009], [Test2].[dbo].[t1].[c1]                                                     NULL     PLAN_ROW                                                         0        1
            |--Compute Scalar(DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]))                                                                                               1           4           3           Compute Scalar                 Compute Scalar                 DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1])                                                                              [Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]                                         1             0             1E-07         19          0.03019842       [Expr1009], [Test2].[dbo].[t1].[c1]                                                                 NULL     PLAN_ROW                                                         0        1
            |    |--Compute Scalar(DEFINE:([Expr1009]=CONVERT_IMPLICIT(int,[Expr1019],0)))                                                                                            1           5           4           Compute Scalar                 Compute Scalar                 DEFINE:([Expr1009]=CONVERT_IMPLICIT(int,[Expr1019],0))                                                                                [Expr1009]=CONVERT_IMPLICIT(int,[Expr1019],0)                                           1             0             1.1E-06       19          0.03019832       [Test2].[dbo].[t1].[c1], [Expr1009]                                                                 NULL     PLAN_ROW                                                         0        1
            |         |--Stream Aggregate(GROUP BY:([Test2].[dbo].[t1].[c1]) DEFINE:([Expr1019]=COUNT([Test2].[dbo].[t1].[c3])))                                                      1           6           5           Stream Aggregate               Aggregate                      GROUP BY:([Test2].[dbo].[t1].[c1])                                                                                                    [Expr1019]=COUNT([Test2].[dbo].[t1].[c3])                                               1             0             1.1E-06       19          0.03019832       [Test2].[dbo].[t1].[c1], [Expr1019]                                                                 NULL     PLAN_ROW                                                         0        1
            |              |--Sort(DISTINCT ORDER BY:([Test2].[dbo].[t1].[c1] ASC, [Test2].[dbo].[t1].[c3] ASC))                                                                      1           7           6           Sort                           Distinct Sort                  DISTINCT ORDER BY:([Test2].[dbo].[t1].[c1] ASC, [Test2].[dbo].[t1].[c3] ASC)                                                          NULL                                                                                    1             0.01126126    0.000100019   19          0.03019721       [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3]                                                    NULL     PLAN_ROW                                                         0        1
            |                   |--Table Spool                                                                                                                                        1           9           7           Table Spool                    Eager Spool                    NULL                                                                                                                                  NULL                                                                                    1             0.006579998   5.041407E-05  31          0.01883594       [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3], [Test2].[dbo].[t2].[c3]                           NULL     PLAN_ROW                                                         0        1
            |                        |--Hash Match(Inner Join, HASH:([Test2].[dbo].[t2].[c1])=([Test2].[dbo].[t1].[c1]), RESIDUAL:([Test2].[dbo].[t2].[c1]=[Test2].[dbo].[t1].[c1]))  1           10          9           Hash Match                     Inner Join                     HASH:([Test2].[dbo].[t2].[c1])=([Test2].[dbo].[t1].[c1]), RESIDUAL:([Test2].[dbo].[t2].[c1]=[Test2].[dbo].[t1].[c1])                  NULL                                                                                    1             0             0.01777693    31          0.02434613       [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3], [Test2].[dbo].[t2].[c1], [Test2].[dbo].[t2].[c3]  NULL     PLAN_ROW                                                         0        1
            |                             |--Table Scan(OBJECT:([Test2].[dbo].[t2]))                                                                                                  1           11          10          Table Scan                     Table Scan                     OBJECT:([Test2].[dbo].[t2])                                                                                                           [Test2].[dbo].[t2].[c1], [Test2].[dbo].[t2].[c3]                                        1             0.003125      0.0001581     19          0.0032831        [Test2].[dbo].[t2].[c1], [Test2].[dbo].[t2].[c3]                                                    NULL     PLAN_ROW                                                         0        1
            |                             |--Table Scan(OBJECT:([Test2].[dbo].[t1]))                                                                                                  1           12          10          Table Scan                     Table Scan                     OBJECT:([Test2].[dbo].[t1])                                                                                                           [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3]                                        1             0.003125      0.0001581     19          0.0032831        [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3]                                                    NULL     PLAN_ROW                                                         0        1
            |--Compute Scalar(DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]))                                                                                               1           26          3           Compute Scalar                 Compute Scalar                 DEFINE:([Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1])                                                                              [Test2].[dbo].[t1].[c1]=[Test2].[dbo].[t1].[c1]                                         1             0             1E-07         19          0.03019842       [Expr1008], [Test2].[dbo].[t1].[c1]                                                                 NULL     PLAN_ROW                                                         0        1
                 |--Compute Scalar(DEFINE:([Expr1008]=CASE WHEN [Expr1020]=(0) THEN NULL ELSE [Expr1021] END))                                                                        1           27          26          Compute Scalar                 Compute Scalar                 DEFINE:([Expr1008]=CASE WHEN [Expr1020]=(0) THEN NULL ELSE [Expr1021] END)                                                            [Expr1008]=CASE WHEN [Expr1020]=(0) THEN NULL ELSE [Expr1021] END                       1             0             1.1E-06       19          0.03019832       [Test2].[dbo].[t1].[c1], [Expr1008]                                                                 NULL     PLAN_ROW                                                         0        1
                      |--Stream Aggregate(GROUP BY:([Test2].[dbo].[t1].[c1]) DEFINE:([Expr1020]=COUNT_BIG([Test2].[dbo].[t2].[c3]), [Expr1021]=SUM([Test2].[dbo].[t2].[c3])))         1           28          27          Stream Aggregate               Aggregate                      GROUP BY:([Test2].[dbo].[t1].[c1])                                                                                                    [Expr1020]=COUNT_BIG([Test2].[dbo].[t2].[c3]), [Expr1021]=SUM([Test2].[dbo].[t2].[c3])  1             0             1.1E-06       19          0.03019832       [Test2].[dbo].[t1].[c1], [Expr1020], [Expr1021]                                                     NULL     PLAN_ROW                                                         0        1
                           |--Sort(ORDER BY:([Test2].[dbo].[t1].[c1] ASC))                                                                                                            1           29          28          Sort                           Sort                           ORDER BY:([Test2].[dbo].[t1].[c1] ASC)                                                                                                NULL                                                                                    1             0.01126126    0.000100019   19          0.03019721       [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t2].[c3]                                                    NULL     PLAN_ROW                                                         0        1
                                |--Table Spool                                                                                                                                        1           31          29          Table Spool                    Eager Spool                    NULL                                                                                                                                  NULL                                                                                    1             0.006579998   5.041407E-05  31          0.01883594       [Test2].[dbo].[t1].[c1], [Test2].[dbo].[t1].[c3], [Test2].[dbo].[t2].[c3]                           NULL     PLAN_ROW                                                         0        1
??? ??? ??? ??????? ?????? ??? ???? ???? ?? 2,147,483,648 ????? ??? ???????.

???????

???? ???????: 937533 - ????? ??? ??????: 01/?????/1428 - ??????: 1.4
????? ???
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Standard X64 Edition
  • Microsoft SQL Server 2005 Standard Edition for Itanium Based Systems
  • Microsoft SQL Server 2005 Enterprise X64 Edition
  • Microsoft SQL Server 2005 Enterprise Edition for Itanium Based Systems
????? ??????: 
kbmt kbsql2005engine kbexpertiseadvanced kbfix kbpubtypekc kbqfe KB937533 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????937533

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com