Hot Off The Press: The NoCOUG Journal and the Second International NoCOUG SQL Challenge
Dear NoCOUG members and friends,
Is RAC on NAS safe and performant? Can virtual machines deliver the performance we need? Should we store BLOBS in the database? For what situations can we safely use RAID-5? Storage expert James Morle answers these questions and more in the new issue of the NoCOUG Journal. The Wizard of Odds is also back with the Second International NoCOUG SQL Challenge. Click here to download the NoCOUG Journal.
Who amongst us has not visited the AskTom website looking for the solution to an Oracle database problem? In this issue of the NoCOUG Journal, Tom says: When I first started out in IT, I had no experience, no training, no background whatsoever. I was a math major fresh out of college in the year 1987. I hadn’t taken any computer courses beyond the initial “introduction to” type of classes. It wasn’t until I got a job as a computer programmer—advertised as “no experience required”—that I started even really using computers. So, given that I had no experience, no real formal training—how did I get started, how did I get to where I am today? I think it comes down to two simple words: mentorship and participation. If you agree with Tom Kyte that participation is one of the keys to career success, perhaps you will consider becoming a member of NoCOUG in its 25th anniversary year. Click here to become a NoCOUG member.
In a previous issue of the NoCOUG Journal, Pythian CTO Alex Gorbachev says: If I had to make a decision on whether to invest my money in certification versus conferences or user group fees, I would choose the latter. It definitely gives a better career boost. If you agree that NoCOUG conferences deliver career-boosting Oracle education, perhaps you will consider attending our winter conference which is now less than two weeks away. Click here to register for the winter conference.
To encourage you to become a member of NoCOUG in its 25th anniversary year, Oracle performance expert Craig Shallahamer is offering a discount to NoCOUG members who attend his upcoming performance management classes in Santa Clara. If you want to be able to tackle your next performance problem head on, without blinking, find the root cause with authority, and provide spot on alternatives, by all means take this class. Use discount code NOCOUG when registering. Click here for more information on Craig’s performance management classes.
Oracle would also like to invite NoCOUG members to the Oracle Enterprise Cloud Summit where cloud experts will share real-world best practices, reference architectures, detailed customer case studies, and more. You’ll learn how to transform IT into a superior service provider with a strategy and roadmap for building, deploying, and managing an enterprise cloud. Click here to register for the cloud summit.
Kindest regards,
The NoCOUG Board of Directors
P.S. We hope to see you again at our winter conference which is now less than two weeks away.
Five “DBA Survivors” are all smiles at the summer conference. Hey Chris, you’re holding the NoCOUG Journal upside down!
SQL commands for creating the required data for the SQL challenge are available at http://bit.ly/g58WVn. The results of the previous challenge are available at http://bit.ly/heUb1T.
This does not seems to be an SQL challenge (at least for me). Also see Rob’s response here:
http://rwijk.blogspot.com/2009/03/calculating-probabilities-with-n-throws.html
This time we decided to make the challenge a little more fun. The previous challenge was a pure SQL exercise. The new challenge starts out as a puzzle. First the relationship between the words has to be determined, perhaps by analyzing the words using SQL or some other means. Once the relationship between the words has been determined, the secret message has to be reconstructed using SQL.
Hi Iggy,
thanks a lot for the interesting article comparing different sql formulations’ execution plans! I was a bit puzzled by the last one, could you expand on it a little bit? Normally, if I remember correctly the “reference” explanation in Chris Antognini’s book (I don’t have it here), the first operation to be executed should be – in case of a non-combining statement like “select”, it’s (only) child (so here, the table scan or rather, the scan’s “child”, the index access – but here I’d assume the second table is scanned first… in fact I’d think that really there was a nested loop, probably, starting with records in the payroll table and getting the employees by index lookup, one by one…
On the other hand, if this was what’s really happening, then the plan would say so I guess :-;
Could you give a hint what’s going on here, please?
Thanks,
Sigrid
Hi, Sigrid,
Thanks for the careful reading of the SQL Corner article. The last EXPLAIN plan output is definitely an oddity that breaks all the rules for reading query plans 🙂 It is “the exception that proves the rule.” You’re right that the full scan of the PAYROLL table must be performed first; there’s no other possibility.
Kindest regards,
Iggy
The following solution was received from Rob van Wijk in the Netherlands.
Date: Tue, 15 Feb 2011 22:08:01 +0100
Subject: Second International NoCOUG SQL Challenge
Hello Iggy and Jonathan,
At first I thought there wasn’t enough information to get started, but once I understood that that was part of the fun, I was hooked!
Thanks and compliments to the one who created the puzzle.
My Es-Cue-El spell:
Regards,
Rob.
The following solution was received from Ilya Chuhnakov:
Date: Wed, 16 Feb 2011 14:18:21 +0300
Subject: NoCOUG SQL Challenge 201102
Hi!
If it is not too late yet, following are my solutions for the NoCOUG SQL Challenge 201102.
1. The first solution is based on Oracle MODEL clause and just ‘automagically’ works.
There is nothing to comment i guess, as that solution is just too simple, thanks Oracle.
Tested on Oracle DB 11gR1.
2. Since the MODEL-based solution was way too simple, i tried another approach (requires Oracle 11gR2).
This time I’ve used CONNECT BY clause to build the tree and 11gR2 LISTAGG to compile words into text.
The tricky part here was the LISTAGG ordering.
I’ve defined recursive ordering function as:
I(N) = I(P(N)) + S(N) / (2^L(N))
where
N is the node
P(N) is the parent of N
S(N) is -1 if N is left side of P(N) (i.e. N=WORD1(P(N)) and +1 otherwise
L(N) is node’s depth (i.e. connect by’s LEVEL)
I think something similar is documented somewhere (around http://en.wikipedia.org/wiki/Tree_traversal#Breadth-first_Traversal).
But this one is just from my head, so the algorithm and its description may be a bit clunky. Sorry for that.
Anyways, given that algorithm, I’ve used SYS_CONNECT_BY_PATH (for “recursion”) to build the expression that evaluates to I(N).
And DBMS_AW to actually evaluate the expression to number. Then just aggregate with LISTAGG and KEEP FIRST the biggest text.
—
with best regards
Ilya Chuhnakov
Another solution by Ilya Chuhnakov:
Date: Fri, 18 Feb 2011 03:22:28 +0300
Subject: Re: NoCOUG SQL Challenge 201102
Hi!
Just got another idea for your riddle.
It’s CONNECT BY with LISTAGG again, this time with START WITH (for performance reasons).
And it just uses SYS_CONNECT_BY_PATH to form the node path which is used for LISTAGG ordering.
Each node appears as either ‘L’ or ‘R’ within the path (whether it is left or right child) and has ‘M’ on it’s end, so the node will be between it’s children after ordering (I originally used ‘abc’, but ‘LMR’ looks better I think).
The following solution was received from Anton Scheffer:
Date: Mon, 21 Feb 2011 17:21:54 +0100
Subject: Oracle Solution
Hi,
My solution for the second SQLchallenge is not very portable, using the Oracle specific model clause, but using the following Es-Cue-El spell
I get the following secret message
Anton Scheffer
The following solution was received from Marcus Matzberger:
Date: Mon, 21 Feb 2011 20:40:15 +0100
Subject: SQL Challenge
Hello,
my solution worked on Oracle 11g2, though I must admit that after I finished I found solutions at the web I liked better. Anyway, this has been the first time I used RCTE and it took some gray matter between my own ears to get the result.
Regards
Marcus
The following solution was received from Timo Raitalaakso:
Date: Mon, 28 Feb 2011 23:21:46 +0200
Subject: Rafu answering
http://rafudb.blogspot.com/2011/02/nocoug-second-sql-challenge.html
Including a graphviz picture of the riddle data.
—
Timo Raitalaakso
http://rafudb.blogpost.com
Hey Iggy –
Was a winner / winning solutions ever posted for the SQL Challenge? I haven’t seen anything about it and would like to see the best of what people came up with.
Thanks, Craig. The winner will be announced in the 100th issue of the NoCOUG Journal which will be published in the first week of November to coincide with NoCOUG Conference 100. The PDF of the Journal will be made available on the NoCOUG website.
Thanks Iggy. As always, I look forward to the journal. Congratulations on reaching 100 conferences / journals.. quite the feat, especially in todays environment.
The results of the Second International NoCOUG SQL Challenge have been published in the 100th issue of the NoCOUG Journal (http://bit.ly/rC2gRA.) The winners are Andre Araujo (Australia), Rob van Wijk (Netherlands), and Ilya Chuhnakov (Russia.) Each winner will receive an Amazon Kindle from contest sponsor Pythian and the August Order of the Wooden Pretzel in keeping with the pronouncement of Steven Feuerstein that “some people can perform seeming miracles with straight Es-Cue-El, but the statements end up looking like pretzels created by somebody who is experimenting with hallucinogens.”
An additional solution is listed at https://iggyfernandez.wordpress.com/2011/12/21/results-of-the-second-international-nocoug-sql-challenge-2/