Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

Weird behaviour?
Hi, I've got a seemingly unique situation. The query I have has a date
field (TrackTime). There are about 50k records, and the query execution
is very different for different time spans selected. Specifically, if I
search for records between 10-Nov-2006 00:00 and 28-Nov-2006 23:59, I
get 42k records and the query is executed in 20 seconds.
But, if I search for records between 28-Nov-2006 00:00 and 28-Nov-2006
23:59 (one day's worth), the query keeps running for more than 10
minutes, and if terminated, shows only 2 records.

Please can anyone tell me what's happening?

----------------------------------------------------------------------------
----
Select t1.ActivityID,
t1.Body,
t1.tracktime,
t2.MsgFormat,
t2.MsgDirection,
t1.FlowID,
t2.SrcAppl,
t2.DestAppl,
t2.MsgType,
t2.UniqueID,
t2.MUR,
t2.Amount,
t2.Currency,
t2.Valuedate,
t2. TransactionReference
Number,
t2.SenderBIC,
t2.ReceiverBIC,
t2.MsgRcvdTime,
t2.MsgSentTime,
t2.RspRcvdTime,
t2.RspSentTime,
t2.IsPegaDiverted,
t2.PegaDivertedTime,
t2. PegaDivertedRspRcvdT
ime,
t2. SecondaryRspRcvdTime
,
t2.ACKStatus,
t2.Level1ServiceName,
t2.ACKTimestamp,
t2.ExceptionOrNAKCode,
t2.TRXMNumber,
t2.BusDealId,
t2.SourceType,
t2.ACKSourceId,
t2.ACK2Status
from dbo. bam_IntegratorBodyTr
acking_AllInstances t1 WITH (NOLOCK) ,
dbo. bam_IntegratorMessag
eFlow_AllInstances t2 WITH (NOLOCK)
where  t2.SrcAppl NOT IN ('HOST MEMO','GMU IP','GMU OP')
and t2.DestAppl NOT IN ('DEAD LETTER','GMU TICS','GMU PAYMENT','GMU
MEMIR','GMU MEMBP') and
t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
<=  convert(datetime,'28
 nov 2006 23:59')
and t2.destappl is not null and t1.ActivityID = t2.ActivityID ORDER BY
trackTime
----------------------------------------------------------------------------
----


Report this thread to moderator Post Follow-up to this message
Old Post
akashkurdekar@gmail.com
11-30-06 12:12 AM


Re: Weird behaviour?
This does sound strange.  Does it happen all the time or did you check
it once?  If it happens all the time, then I would check the query plan
for both queries.  There is a good chance that the query for the one
day is using an index and the query for the 18 days is doing a table
scan.  In that case I would check the index with DBCC CHECKTABLE.   I
admit that this is a shot in the dark, but this is the only thing that
I can think about.

Adi


akashkurdekar@gmail.com  wrote:[color=darkred
]
> Hi, I've got a seemingly unique situation. The query I have has a date
> field (TrackTime). There are about 50k records, and the query execution
> is very different for different time spans selected. Specifically, if I
> search for records between 10-Nov-2006 00:00 and 28-Nov-2006 23:59, I
> get 42k records and the query is executed in 20 seconds.
> But, if I search for records between 28-Nov-2006 00:00 and 28-Nov-2006
> 23:59 (one day's worth), the query keeps running for more than 10
> minutes, and if terminated, shows only 2 records.
>
> Please can anyone tell me what's happening?
>
> --------------------------------------------------------------------------
------
> Select t1.ActivityID,
> t1.Body,
> t1.tracktime,
> t2.MsgFormat,
> t2.MsgDirection,
> t1.FlowID,
> t2.SrcAppl,
> t2.DestAppl,
> t2.MsgType,
> t2.UniqueID,
> t2.MUR,
> t2.Amount,
> t2.Currency,
> t2.Valuedate,
> t2. TransactionReference
Number,
> t2.SenderBIC,
> t2.ReceiverBIC,
> t2.MsgRcvdTime,
> t2.MsgSentTime,
> t2.RspRcvdTime,
> t2.RspSentTime,
> t2.IsPegaDiverted,
> t2.PegaDivertedTime,
> t2. PegaDivertedRspRcvdT
ime,
> t2. SecondaryRspRcvdTime
,
> t2.ACKStatus,
> t2.Level1ServiceName,
> t2.ACKTimestamp,
> t2.ExceptionOrNAKCode,
> t2.TRXMNumber,
> t2.BusDealId,
> t2.SourceType,
> t2.ACKSourceId,
> t2.ACK2Status
> from dbo. bam_IntegratorBodyTr
acking_AllInstances t1 WITH (NOLOCK) ,
> dbo. bam_IntegratorMessag
eFlow_AllInstances t2 WITH (NOLOCK)
> where  t2.SrcAppl NOT IN ('HOST MEMO','GMU IP','GMU OP')
> and t2.DestAppl NOT IN ('DEAD LETTER','GMU TICS','GMU PAYMENT','GMU
> MEMIR','GMU MEMBP') and
> t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
> <=  convert(datetime,'28
 nov 2006 23:59')
> and t2.destappl is not null and t1.ActivityID = t2.ActivityID ORDER BY
> trackTime
> --------------------------------------------------------------------------------[/
color]


Report this thread to moderator Post Follow-up to this message
Old Post
Adi
11-30-06 12:12 AM


Re: Weird behaviour?
akashkurdekar@gmail.com  wrote:
> Hi, I've got a seemingly unique situation. The query I have has a date
> field (TrackTime). There are about 50k records, and the query execution
> is very different for different time spans selected. Specifically, if I
> search for records between 10-Nov-2006 00:00 and 28-Nov-2006 23:59, I
> get 42k records and the query is executed in 20 seconds.
> But, if I search for records between 28-Nov-2006 00:00 and 28-Nov-2006
> 23:59 (one day's worth), the query keeps running for more than 10
> minutes, and if terminated, shows only 2 records.
>
> Please can anyone tell me what's happening?
>
> --------------------------------------------------------------------------
------
> Select t1.ActivityID,
> t1.Body,
> t1.tracktime,
> t2.MsgFormat,
> t2.MsgDirection,
> t1.FlowID,
> t2.SrcAppl,
> t2.DestAppl,
> t2.MsgType,
> t2.UniqueID,
> t2.MUR,
> t2.Amount,
> t2.Currency,
> t2.Valuedate,
> t2. TransactionReference
Number,
> t2.SenderBIC,
> t2.ReceiverBIC,
> t2.MsgRcvdTime,
> t2.MsgSentTime,
> t2.RspRcvdTime,
> t2.RspSentTime,
> t2.IsPegaDiverted,
> t2.PegaDivertedTime,
> t2. PegaDivertedRspRcvdT
ime,
> t2. SecondaryRspRcvdTime
,
> t2.ACKStatus,
> t2.Level1ServiceName,
> t2.ACKTimestamp,
> t2.ExceptionOrNAKCode,
> t2.TRXMNumber,
> t2.BusDealId,
> t2.SourceType,
> t2.ACKSourceId,
> t2.ACK2Status
> from dbo. bam_IntegratorBodyTr
acking_AllInstances t1 WITH (NOLOCK) ,
> dbo. bam_IntegratorMessag
eFlow_AllInstances t2 WITH (NOLOCK)
> where  t2.SrcAppl NOT IN ('HOST MEMO','GMU IP','GMU OP')
> and t2.DestAppl NOT IN ('DEAD LETTER','GMU TICS','GMU PAYMENT','GMU
> MEMIR','GMU MEMBP') and
> t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
> <=  convert(datetime,'28
 nov 2006 23:59')
> and t2.destappl is not null and t1.ActivityID = t2.ActivityID ORDER BY
> trackTime
> --------------------------------------------------------------------------
------
>

Run your second query, wait for it to "hang", then check sysprocesses to
see if something is blocking it.  Also compare the execution plans of
the two queries, looking for obvious differences.


--
Tracy McKibben
MCDBA
http://www.realsqlguy.com

Report this thread to moderator Post Follow-up to this message
Old Post
Tracy McKibben
11-30-06 12:13 AM


Re: Weird behaviour?
I don't think that this is due to blocking because he is using the
nolock hint for all tables in the query.

Adi

Tracy McKibben  wrote:
> akashkurdekar@gmail.com wrote: 
>
> Run your second query, wait for it to "hang", then check sysprocesses to
> see if something is blocking it.  Also compare the execution plans of
> the two queries, looking for obvious differences.
>
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com


Report this thread to moderator Post Follow-up to this message
Old Post
Adi
11-30-06 05:12 AM


Re: Weird behaviour?
Hi
Have you look into an executiuon plan? BTW,what is the version are you
using? In SQL Server 2005 you can recompile on statement level.

What is happening if you change
t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
<=  convert(datetime,dat
eadd(d,1,'28 nov 2006 00:00'))



<akashkurdekar@gmail.com> wrote in message
news:1164816180.774097.240110@80g2000cwy.googlegroups.com...
> Hi, I've got a seemingly unique situation. The query I have has a date
> field (TrackTime). There are about 50k records, and the query execution
> is very different for different time spans selected. Specifically, if I
> search for records between 10-Nov-2006 00:00 and 28-Nov-2006 23:59, I
> get 42k records and the query is executed in 20 seconds.
> But, if I search for records between 28-Nov-2006 00:00 and 28-Nov-2006
> 23:59 (one day's worth), the query keeps running for more than 10
> minutes, and if terminated, shows only 2 records.
>
> Please can anyone tell me what's happening?
>
> --------------------------------------------------------------------------
------
> Select t1.ActivityID,
> t1.Body,
> t1.tracktime,
> t2.MsgFormat,
> t2.MsgDirection,
> t1.FlowID,
> t2.SrcAppl,
> t2.DestAppl,
> t2.MsgType,
> t2.UniqueID,
> t2.MUR,
> t2.Amount,
> t2.Currency,
> t2.Valuedate,
> t2. TransactionReference
Number,
> t2.SenderBIC,
> t2.ReceiverBIC,
> t2.MsgRcvdTime,
> t2.MsgSentTime,
> t2.RspRcvdTime,
> t2.RspSentTime,
> t2.IsPegaDiverted,
> t2.PegaDivertedTime,
> t2. PegaDivertedRspRcvdT
ime,
> t2. SecondaryRspRcvdTime
,
> t2.ACKStatus,
> t2.Level1ServiceName,
> t2.ACKTimestamp,
> t2.ExceptionOrNAKCode,
> t2.TRXMNumber,
> t2.BusDealId,
> t2.SourceType,
> t2.ACKSourceId,
> t2.ACK2Status
> from dbo. bam_IntegratorBodyTr
acking_AllInstances t1 WITH (NOLOCK) ,
> dbo. bam_IntegratorMessag
eFlow_AllInstances t2 WITH (NOLOCK)
> where  t2.SrcAppl NOT IN ('HOST MEMO','GMU IP','GMU OP')
> and t2.DestAppl NOT IN ('DEAD LETTER','GMU TICS','GMU PAYMENT','GMU
> MEMIR','GMU MEMBP') and
> t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
> <=  convert(datetime,'28
 nov 2006 23:59')
> and t2.destappl is not null and t1.ActivityID = t2.ActivityID ORDER BY
> trackTime
> --------------------------------------------------------------------------
------
>



Report this thread to moderator Post Follow-up to this message
Old Post
Uri Dimant
11-30-06 10:17 AM


RE: Weird behaviour?
Are there any indexes on these tables?  If so, how often are they rebuilt?
Also, have you checked the execution plan to ensure they are being used?

"akashkurdekar@gmail.com" wrote:

> Hi, I've got a seemingly unique situation. The query I have has a date
> field (TrackTime). There are about 50k records, and the query execution
> is very different for different time spans selected. Specifically, if I
> search for records between 10-Nov-2006 00:00 and 28-Nov-2006 23:59, I
> get 42k records and the query is executed in 20 seconds.
> But, if I search for records between 28-Nov-2006 00:00 and 28-Nov-2006
> 23:59 (one day's worth), the query keeps running for more than 10
> minutes, and if terminated, shows only 2 records.
>
> Please can anyone tell me what's happening?
>
> --------------------------------------------------------------------------
------
> Select t1.ActivityID,
> t1.Body,
> t1.tracktime,
> t2.MsgFormat,
> t2.MsgDirection,
> t1.FlowID,
> t2.SrcAppl,
> t2.DestAppl,
> t2.MsgType,
> t2.UniqueID,
> t2.MUR,
> t2.Amount,
> t2.Currency,
> t2.Valuedate,
> t2. TransactionReference
Number,
> t2.SenderBIC,
> t2.ReceiverBIC,
> t2.MsgRcvdTime,
> t2.MsgSentTime,
> t2.RspRcvdTime,
> t2.RspSentTime,
> t2.IsPegaDiverted,
> t2.PegaDivertedTime,
> t2. PegaDivertedRspRcvdT
ime,
> t2. SecondaryRspRcvdTime
,
> t2.ACKStatus,
> t2.Level1ServiceName,
> t2.ACKTimestamp,
> t2.ExceptionOrNAKCode,
> t2.TRXMNumber,
> t2.BusDealId,
> t2.SourceType,
> t2.ACKSourceId,
> t2.ACK2Status
> from dbo. bam_IntegratorBodyTr
acking_AllInstances t1 WITH (NOLOCK) ,
> dbo. bam_IntegratorMessag
eFlow_AllInstances t2 WITH (NOLOCK)
> where  t2.SrcAppl NOT IN ('HOST MEMO','GMU IP','GMU OP')
> and t2.DestAppl NOT IN ('DEAD LETTER','GMU TICS','GMU PAYMENT','GMU
> MEMIR','GMU MEMBP') and
> t1.tracktime >=  convert(datetime,'28
 nov 2006 00:00') and t1.tracktime
> <=  convert(datetime,'28
 nov 2006 23:59')
> and t2.destappl is not null and t1.ActivityID = t2.ActivityID ORDER BY
> trackTime
> --------------------------------------------------------------------------
------
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
F_clef
12-01-06 12:14 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 09:07 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006