Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Need high resource expensive sql queries Expand / Collapse
Author
Message
Posted Tuesday, September 7, 2010 1:30 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-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
Posted Tuesday, September 7, 2010 2:48 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:08 AM
Points: 7,147, Visits: 13,213
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
Posted Tuesday, September 7, 2010 6:45 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, May 23, 2014 5:59 AM
Points: 329, Visits: 470
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
Posted Tuesday, September 7, 2010 3:20 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:34 PM
Points: 36,978, Visits: 31,498
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 "Row-By-Agonizing-Row".

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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #981942
Posted Tuesday, September 7, 2010 3:35 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, April 30, 2014 12:57 PM
Points: 576, Visits: 692
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
Posted Wednesday, September 8, 2010 1:23 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, May 23, 2014 5:59 AM
Points: 329, Visits: 470
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
Posted Wednesday, September 8, 2010 5:17 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:34 PM
Points: 36,978, Visits: 31,498
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 "Row-By-Agonizing-Row".

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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #982194
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse