Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
SQL Server 2005 Performance Tuning
»
Need high resource expensive sql queries
Need high resource expensive sql queries
Rate Topic
Display Mode
Topic Options
Author
Message
sejal p gudhka
sejal p gudhka
Posted Tuesday, September 07, 2010 1:30 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, April 17, 2012 11:29 PM
Points: 138,
Visits: 236
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.
Post #981376
LutzM
LutzM
Posted Tuesday, September 07, 2010 2:48 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 3:17 PM
Points: 6,731,
Visits: 12,131
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!
Lutz
A pessimist is an optimist with experience.
How to get fast answers to your question
How to post performance related questions
Links for
Tally Table
,
Cross Tabs
and
Dynamic Cross Tabs
,
Delimited Split Function
Post #981398
Madhivanan-208264
Madhivanan-208264
Posted Tuesday, September 07, 2010 6:45 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, September 12, 2012 5:17 AM
Points: 329,
Visits: 461
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
Madhivanan
Failing to plan is Planning to fail
Post #981518
Jeff Moden
Jeff Moden
Posted Tuesday, September 07, 2010 3:20 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 32,906,
Visits: 26,792
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
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #981942
Derrick Smith
Derrick Smith
Posted Tuesday, September 07, 2010 3:35 PM
Mr or Mrs. 500
Group: General Forum Members
Last Login: 2 days ago @ 1:04 PM
Points: 574,
Visits: 684
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.
Post #981951
Madhivanan-208264
Madhivanan-208264
Posted Wednesday, September 08, 2010 1:23 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, September 12, 2012 5:17 AM
Points: 329,
Visits: 461
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?
Madhivanan
Failing to plan is Planning to fail
Post #982083
Jeff Moden
Jeff Moden
Posted Wednesday, September 08, 2010 5:17 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 32,906,
Visits: 26,792
Madhivanan-208264 (9/8/2010)
The avatar you used is very good
Are 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
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #982194
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.