Viewing 15 posts - 3,106 through 3,120 (of 3,957 total)
For what it's worth, this version breaks the 5 CPU sec barrier consistently and sometimes 5 secs elapsed time too. Still in 3rd place though.
PRINT '========== DWAIN IMPROVED (SLIGHTLY)...
August 6, 2012 at 8:30 pm
BTW. Adding OPTION (MAXDOP 1) to SomewhereSomehow and Mark's gets these results (good improvement on CPU at expense of some elapsed time).
========== SomewhereSomehow ===========================================
SQL Server Execution Times:
...
August 6, 2012 at 7:58 pm
Not as fast as CELKO or IMPROVED CELKO but a strong third place is this option:
--===== Conditionally drop the test table to make reruns in SSMS easier.
...
August 6, 2012 at 7:50 pm
I think the reason no one has replied to you in 2 days is because you seem to have posted many questions, but none of them clearly enough for us...
August 6, 2012 at 7:29 pm
Actually, CTEs are more like a more readable version of a derived table. I prefer them to derived tables because of the readability they add to a complex query.
They...
August 6, 2012 at 7:10 pm
SomewhereSomehow (8/3/2012)
August 6, 2012 at 7:04 pm
Mike McIver (8/6/2012)
now have to stick my neck out, and put up or shut up on the Quarter version. This "report" is getting silly (45k rows, ridiculous format, performance...
August 6, 2012 at 6:46 pm
Mike McIver (8/6/2012)Looks like Revenue "% O/(U) Prev Mo" is off a little here and there for nov and dec ... oops. Not to rub it in ... but...
August 6, 2012 at 5:12 am
You are probably better off using a Tally table for this:
CREATE TABLE #TempBet
(High int, Low int)
INSERT INTO #TempBet (Low, High)
SELECT 1, 3 UNION ALL
SELECT 2, 3 UNION All
SELECT 5, 8
;WITH...
August 5, 2012 at 10:33 pm
Mike McIver (8/3/2012)
I'm not sure I'd agree with you on which is more maintainable.
... May we see a "full year" version of the cross apply? Then we'll start...
August 5, 2012 at 7:42 pm
mishaluba (8/2/2012)
...
August 2, 2012 at 11:55 pm
cliffb (8/2/2012)
IF OBJECT_ID('tempdb..#Orders','U') IS NOT NULL
DROP TABLE #Orders
-- DDL and sample data...
August 2, 2012 at 8:14 pm
Mike McIver (8/2/2012)
Here's the last example done with pivot/unpivot ... a bit more code, performance not as good ... but much more maintainable/flexible (IMO)...
August 2, 2012 at 7:59 pm
Cadavre, ChrisM, WayneS and jfogel -
Your positive comments are much appreciated. I was really hoping that few people had actually seen this approach because it does seem to be...
August 2, 2012 at 7:57 pm
gsimard (8/2/2012)
Basically, your "other Unpivot" technique is a brillant way to use the new (from 2008) Table Value Constructor
Using the same method, from your first...
August 2, 2012 at 7:53 pm
Viewing 15 posts - 3,106 through 3,120 (of 3,957 total)