Home > Archive > Microsoft SQL Server forum > July 2005 > Massive amoutns of Reading









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Massive amoutns of Reading
Greg D. Moore \(Strider\)

2005-07-22, 3:23 am



Our database server has started acting weird and at this point I'm either
too sleep deprived or close to the problem to adequately diagnose the issue.

Basically to put it simply... when I look at the read disk queue length, the
disks queues are astronomical.

normally we're seeing a disk queue length of 0-1 on the disks that contain
the DB data and index. (i.e non clustered indexes are on a disk of their
own).

Writes are just fine.

Problem is, all our databases are on the same drive, and I can't seem to
nail down which DB, let alone which table is the source of all our reads.

Now, to really make things weirder.. during the busier times of the day
today (say 1:00 PM to 4:00 PM) things were fine.

At 4:20 PM or so it was like someone hit a switch and read disk queue length
jumped from 0-1 up to 100-200+... with spikes up to 1500 for a split second
or so.

What's the best way folks know to nail down this?

Thanks.



--
--


Erland Sommarskog

2005-07-22, 8:23 pm

Greg D. Moore (Strider) (mooregr_deleteth1s@
greenms.com) writes:
> Our database server has started acting weird and at this point I'm
> either too sleep deprived or close to the problem to adequately diagnose
> the issue.
>
> Basically to put it simply... when I look at the read disk queue length,
> the disks queues are astronomical.
>
> normally we're seeing a disk queue length of 0-1 on the disks that contain
> the DB data and index. (i.e non clustered indexes are on a disk of their
> own).
>
> Writes are just fine.
>
> Problem is, all our databases are on the same drive, and I can't seem to
> nail down which DB, let alone which table is the source of all our reads.
>
> Now, to really make things weirder.. during the busier times of the day
> today (say 1:00 PM to 4:00 PM) things were fine.
>
> At 4:20 PM or so it was like someone hit a switch and read disk queue
> length jumped from 0-1 up to 100-200+... with spikes up to 1500 for a
> split second or so.
>
> What's the best way folks know to nail down this?


I would use Profiler. I'm also fond of my own aba_lockinfo, which
gives a snapshot of all active processes, their locks and their
statements. You find it on
http://www.sommarskog.se/sqlutil/aba_lockinfo.html.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
Greg D. Moore \(Strider\)

2005-07-23, 3:23 am


"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns969BF2E00BF3
BYazorman@127.0.0.1...
>
> I would use Profiler. I'm also fond of my own aba_lockinfo, which
> gives a snapshot of all active processes, their locks and their
> statements. You find it on
> http://www.sommarskog.se/sqlutil/aba_lockinfo.html.
>


Actually we nailed it down.

I can't post DDL right now (proprietary and all) BUT... here's the gist of
it.

Found the query. Somewhat complex that has a left out join on a view which
includes the base table.
(i.e. foo inner join on view_bar ..... and view_bar contains foo).

Base table contains about 9.5 million rows and is 38 gig in size.

Now on Server A, this generates 600K readaheads.
On Server B: NO physical reads.

As you can imagine, that'll kill performance any day. :-)


Server A is SQL 2000 Enterprise (SP3) on Windows Server 2003 (no SP at this
time).
Clustered, dual 3 gig Xeons with HT ON, 8 gig RAM, 7 Gig for SQL

Server B is SQL 2000 Standard (SP3) on Windows Server 2000 Advanced Server
(SP4)
Stand alone, DAS storage. Quad Xeon 550Mhz, 4 gig RAM (2 gig for SQL)

Clearly the the query plan on A is fubar.

I've updated stats and rebuilt most of the indices (rebuilding the rest
tonight).

But still no joy.

Other suggestions?

I seem to recall a bug in SQL Server views with HT or something. Anything
ring a bell?

Thanks.





>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp



Erland Sommarskog

2005-07-23, 3:23 am

Greg D. Moore (Strider) (mooregr_deleteth1s@
greenms.com) writes:
> Actually we nailed it down.


At least now you know the query. That makes life a little easier!

> Server A is SQL 2000 Enterprise (SP3) on Windows Server 2003 (no SP at
> this time).
> Clustered, dual 3 gig Xeons with HT ON, 8 gig RAM, 7 Gig for SQL
>
> Server B is SQL 2000 Standard (SP3) on Windows Server 2000 Advanced Server
> (SP4)
> Stand alone, DAS storage. Quad Xeon 550Mhz, 4 gig RAM (2 gig for SQL)
>
> Clearly the the query plan on A is fubar.
>
> I've updated stats and rebuilt most of the indices (rebuilding the rest
> tonight).
>
> But still no joy.
>
> Other suggestions?
>
> I seem to recall a bug in SQL Server views with HT or something. Anything
> ring a bell?


Well, there is a standard recommendation to set "max degree of parallelism"
on an HT machine to at most the number of physical processors, thus for
server A to 2.

That alone may not give you a better query plan, but at least lower
load the CPUs. But since it was read-ahead reads that are killing you,
this would be a minor improvement.

You need to analyse the query plans on A and B. If the plan on B does
not have parallelism, but the plan A has, then try to add
"OPTION (MAXDOP 1)" to the query.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
Greg D. Moore \(Strider\)

2005-07-24, 3:23 am


"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns969C64F2AD67
8Yazorman@127.0.0.1...
> Greg D. Moore (Strider) (mooregr_deleteth1s@
greenms.com) writes:
>
> Well, there is a standard recommendation to set "max degree of

parallelism"
> on an HT machine to at most the number of physical processors, thus for
> server A to 2.


Tried that, no joy.
>
> That alone may not give you a better query plan, but at least lower
> load the CPUs. But since it was read-ahead reads that are killing you,
> this would be a minor improvement.
>
> You need to analyse the query plans on A and B. If the plan on B does
> not have parallelism, but the plan A has, then try to add
> "OPTION (MAXDOP 1)" to the query.
>


Remind me of the syntax on this?

In any way, the temporary fix was fairly simple.

In the query itself or the join (which actually is better in our case)
giving a JOIN hint (doesn't really matter which one I use) immediately
improves the performance of the query.

So for now we've added the hint to the VIEW.

I'm going to plan out an upgrade to SP4 with the AWE hotfix in the next week
or so and see if that provides the "real" fix for this query.

Very annoying though.

Thanks for the suggestions though.


> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp



Erland Sommarskog

2005-07-24, 7:27 am

Greg D. Moore (Strider) (mooregr_deleteth1s@
greenms.com) writes:
> Remind me of the syntax on this?
>
> In any way, the temporary fix was fairly simple.
>
> In the query itself or the join (which actually is better in our case)
> giving a JOIN hint (doesn't really matter which one I use) immediately
> improves the performance of the query.
>
> So for now we've added the hint to the VIEW.


Glad to hear that you got it working.

If the solution was to change:

a INNER JOIN b

to

a INNER LOOP JOIN b

there is a side effect: the tables will now be accessed in the order
they appear in the query. This may be good for now, but further along
the road, this may not be the best query plan.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
Greg D. Moore \(Strider\)

2005-07-24, 9:31 am


"Erland Sommarskog" <esquel@sommarskog.se> wrote in message
news:Xns969D7068E9C0
5Yazorman@127.0.0.1...
> Greg D. Moore (Strider) (mooregr_deleteth1s@
greenms.com) writes:
>
> Glad to hear that you got it working.
>
> If the solution was to change:
>
> a INNER JOIN b
>
> to
>
> a INNER LOOP JOIN b
>
> there is a side effect: the tables will now be accessed in the order
> they appear in the query. This may be good for now, but further along
> the road, this may not be the best query plan.


Actually it's an outer join and using HASH or MERGE seems to work fine.


>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp



louis

2005-07-26, 1:23 pm

My guess is that the query is doing a bookmark lookup. When the server
isn't busy, MSSQL is trying to be helpful by issuing read-aheads
against the clustered index. I would try creating a covering index, so
MSSQL will only have to read one index.

Greg D. Moore \(Strider\)

2005-07-26, 8:24 pm


"louis" < louisducnguyen@gmail
.com> wrote in message
news:1122398417.122977.34990@f14g2000cwb.googlegroups.com...
> My guess is that the query is doing a bookmark lookup. When the server
> isn't busy, MSSQL is trying to be helpful by issuing read-aheads
> against the clustered index. I would try creating a covering index, so
> MSSQL will only have to read one index.


Thanks for the guess, but even a covering index doesn't seem to help.


>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com