September 7, 2010 at 1:30 am
Hi All,
I need sql queries or bad tsql code for producing high expensive resource utilization queries to test some performance reports. I ahve adventure works database in my environment. Please let me know as from where will I get high expensive queries for my testing..
thanks in advance.
September 7, 2010 at 2:48 am
Errrmmm... that's a requirement not seen very often... 😉
One option would be to create a c.u.r.s.o.r. on a rather large table (to "avoid" a set based operation).
Inside the c.u.r.s.o.r.:
Join a large number of (large) tables on predicates that are not supported by any index (to force a table scan). Take as many columns as you like and build a large comma delimited string. Insert results into a table variable and use a loop to split the string again by stepping through each character.
Most important: make sure not to run it on a production system!
September 7, 2010 at 6:45 am
Have a million row table and do running total using a triangular join
select col,
(select sum(col) from table as t1 where t1.pkcol<=t2.pkcol) as run_sum
from table as t2
Failing to plan is Planning to fail
September 7, 2010 at 3:20 pm
Madhivanan-208264 (9/7/2010)
Have a million row table and do running total using a triangular join
select col,
(select sum(col) from table as t1 where t1.pkcol<=t2.pkcol) as run_sum
from table as t2
Heh... ya beat me to it, Madhivanan.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 7, 2010 at 3:35 pm
Also force maxdop to 0 if your server isn't already set to it....a horrible, awful query like that should eat up every available core.
September 8, 2010 at 1:23 am
Jeff Moden (9/7/2010)
Madhivanan-208264 (9/7/2010)
Have a million row table and do running total using a triangular join
select col,
(select sum(col) from table as t1 where t1.pkcol<=t2.pkcol) as run_sum
from table as t2
Heh... ya beat me to it, Madhivanan.
Yes. Thats the good example that I know which takes lot of time.
The avatar you used is very good
Are you a designer too? 🙂
Failing to plan is Planning to fail
September 8, 2010 at 5:17 am
Madhivanan-208264 (9/8/2010)
The avatar you used is very goodAre you a designer too? 🙂
No... someone else did most of the work. I just overlaid the word "RBAR" and converted it to a GIF.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply