Missing Statistics IO y Time

  • Hi, I need your help.

    In next query:

    select a.rut_empleado

    from ANTECEDENTE_CONTRACTUALa

    WHERE exists(select 1 from CENTRO_COSTO x

    WHERE a.codigo_centro = x.codigo_centro)

    Why in statistics does not appear references a table CENTRO_COSTO:

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 1 ms.

    (2 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 4 ms, elapsed time = 4 ms.

    StmtText

    ----------------------------------------------------------------------------------------------------------------------------------------------

    select a.rut_empleado

    from ANTECEDENTE_CONTRACTUALa

    WHERE exists(select 1 from CENTRO_COSTO x

    WHERE a.codigo_centro = x.codigo_centro)

    (1 row(s) affected)

    StmtText

    ------------------------------------------------------------------------------------------------------------

    |--Index Scan(OBJECT:([Reparador].[dbo].[ANTECEDENTE_CONTRACTUAL].[IK_ANTCONTRACTUAL_CENTRO#cen] AS [a]))

    (1 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 1 ms.

    (2 row(s) affected)

    THANKS, Bye... Daniel Maldonado Guzmán.

  • Did you turn statistics io on?

    Are there rows in both of those tables?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Yes, Statistics is On

    And both tables having data.

    select count(*) from ANTECEDENTE_CONTRACTUAL --> 9155

    select count(*) from CENTRO_COSTO --> 1628

    SQL Server parse and compile time:

    CPU time = 1 ms, elapsed time = 1 ms.

    (3 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 1 ms.

    StmtText

    ---------------------------

    set statistics time oN

    (1 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 1 ms.

    StmtText

    -----------------------

    set statistics IO oN

    (1 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 4 ms.

    StmtText

    ----------------------------------------------------------------------------------------------------------------------------------------------

    select a.rut_empleado

    from ANTECEDENTE_CONTRACTUALa

    WHERE exists(select 1 from CENTRO_COSTO x

    WHERE a.codigo_centro = x.codigo_centro)

    (1 row(s) affected)

    StmtText

    ------------------------------------------------------------------------------------------------------------

    |--Index Scan(OBJECT:([Reparador].[dbo].[ANTECEDENTE_CONTRACTUAL].[IK_ANTCONTRACTUAL_CENTRO#cen] AS [a]))

    (1 row(s) affected)

    SQL Server parse and compile time:

    CPU time = 0 ms, elapsed time = 1 ms.

    (3 row(s) affected)

  • Do you have showplan_all or showplan_text on?

    That option means the query won't get executed, just parsed and optimised. The query's not actually running, so there's no stats output.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Only I have IO y Statistics Time...I don´t have showplan.

    The query retuns 9155 rows. The rows output this good, but statistics IO and Time there are bad.

  • If the showplans aren't on, where does this come from?

    StmtText

    ----------------------------------------------------------------------------------------------------------------------------------------------

    select a.rut_empleado

    from ANTECEDENTE_CONTRACTUAL a

    WHERE exists(select 1 from CENTRO_COSTO x

    WHERE a.codigo_centro = x.codigo_centro)

    (1 row(s) affected)

    StmtText

    ------------------------------------------------------------------------------------------------------------

    |--Index Scan(OBJECT [Sad] [Reparador].[dbo].[ANTECEDENTE_CONTRACTUAL].[IK_ANTCONTRACTUAL_CENTRO#cen] AS [a]))

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply