December 3, 2008 at 8:11 am
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.
December 3, 2008 at 8:26 am
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
December 3, 2008 at 9:02 am
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)
December 3, 2008 at 9:08 am
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
December 3, 2008 at 10:15 am
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.
December 3, 2008 at 1:49 pm
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
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply