Home All Groups Group Topic Archive Search About
Author
30 Jun 2005 3:28 PM
Jeffrey K. Ericson
The following queries;

select
count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
from tblMasterRT
where transactiondatetime>'5/1/2005'
and transactiontype in ('a','r','l','o','j')
and transactioncomplete=1 and flag3=1
group by
year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
order by count(id)
desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)



select
count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
from tblMasterRT
where transactiondatetime>'6/1/2005'
and transactiontype in ('a','r','l','o','j')
and transactioncomplete=1 and flag3=1
group by
year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
order by count(id)
desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)


behave differently.   The second returns 2 times the actual number of rows
for certain days(generally towards then end of the record set).  I updated
stats and have been told the problem existed prior to the last reindex job
that ran successfully.

Any ideas?

Author
30 Jun 2005 3:49 PM
Alejandro Mesa
Can you recreate all the table's indexes?


AMB

Show quote
"Jeffrey K. Ericson" wrote:

> The following queries;
>
> select
> count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> from tblMasterRT
> where transactiondatetime>'5/1/2005'
> and transactiontype in ('a','r','l','o','j')
> and transactioncomplete=1 and flag3=1
> group by
> year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> order by count(id)
> desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
>
>
>
> select
> count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> from tblMasterRT
> where transactiondatetime>'6/1/2005'
> and transactiontype in ('a','r','l','o','j')
> and transactioncomplete=1 and flag3=1
> group by
> year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> order by count(id)
> desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
>
>
> behave differently.   The second returns 2 times the actual number of rows
> for certain days(generally towards then end of the record set).  I updated
> stats and have been told the problem existed prior to the last reindex job
> that ran successfully.
>
> Any ideas?
>
>
Author
30 Jun 2005 5:59 PM
Jeffrey K. Ericson
Can't do that during production hours but I was told this existed prior to
the last successful index rebuild on Sunday.

Show quote
"Alejandro Mesa" wrote:

> Can you recreate all the table's indexes?
>
>
> AMB
>
> "Jeffrey K. Ericson" wrote:
>
> > The following queries;
> >
> > select
> > count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > from tblMasterRT
> > where transactiondatetime>'5/1/2005'
> > and transactiontype in ('a','r','l','o','j')
> > and transactioncomplete=1 and flag3=1
> > group by
> > year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > order by count(id)
> > desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> >
> >
> >
> > select
> > count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > from tblMasterRT
> > where transactiondatetime>'6/1/2005'
> > and transactiontype in ('a','r','l','o','j')
> > and transactioncomplete=1 and flag3=1
> > group by
> > year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > order by count(id)
> > desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> >
> >
> > behave differently.   The second returns 2 times the actual number of rows
> > for certain days(generally towards then end of the record set).  I updated
> > stats and have been told the problem existed prior to the last reindex job
> > that ran successfully.
> >
> > Any ideas?
> >
> >
Author
30 Jun 2005 3:54 PM
David Gugick
Jeffrey K. Ericson wrote:
Show quote
> The following queries;
>
> select
> count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> from tblMasterRT
> where transactiondatetime>'5/1/2005'
> and transactiontype in ('a','r','l','o','j')
> and transactioncomplete=1 and flag3=1
> group by
> year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> order by count(id)
> desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
>
>
>
> select
> count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> from tblMasterRT
> where transactiondatetime>'6/1/2005'
> and transactiontype in ('a','r','l','o','j')
> and transactioncomplete=1 and flag3=1
> group by
> year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> order by count(id)
> desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
>
>
> behave differently.   The second returns 2 times the actual number of
> rows for certain days(generally towards then end of the record set).
> I updated stats and have been told the problem existed prior to the
> last reindex job that ran successfully.
>
> Any ideas?

Add a MAXDOP 1 to the query. Parallelism can sometimes throw off counts.
http://support.microsoft.com/kb/822746
Supposedly fixed in SP4.




--
David Gugick
Quest Software
www.imceda.com
www.quest.com
Author
30 Jun 2005 5:58 PM
Jeffrey K. Ericson
Worked like a charm AND we just bought SQL Safe!

Show quote
"David Gugick" wrote:

> Jeffrey K. Ericson wrote:
> > The following queries;
> >
> > select
> > count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > from tblMasterRT
> > where transactiondatetime>'5/1/2005'
> > and transactiontype in ('a','r','l','o','j')
> > and transactioncomplete=1 and flag3=1
> > group by
> > year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > order by count(id)
> > desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> >
> >
> >
> > select
> > count(id),year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > from tblMasterRT
> > where transactiondatetime>'6/1/2005'
> > and transactiontype in ('a','r','l','o','j')
> > and transactioncomplete=1 and flag3=1
> > group by
> > year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> > order by count(id)
> > desc,year(transactiondatetime),month(transactiondatetime),day(transactiondatetime)
> >
> >
> > behave differently.   The second returns 2 times the actual number of
> > rows for certain days(generally towards then end of the record set).
> > I updated stats and have been told the problem existed prior to the
> > last reindex job that ran successfully.
> >
> > Any ideas?
>
> Add a MAXDOP 1 to the query. Parallelism can sometimes throw off counts.
> http://support.microsoft.com/kb/822746
> Supposedly fixed in SP4.
>
>
>
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>
>
Author
30 Jun 2005 7:07 PM
David Gugick
Jeffrey K. Ericson wrote:
> Worked like a charm AND we just bought SQL Safe!

Hmmm... SQL Safe. That's an Idera product. Well, competition is good for
the soul...

--
David Gugick
Quest Software
www.imceda.com
www.quest.com

AddThis Social Bookmark Button