SQL challenge
Friday, June 6, 2008 3:30:47 PM
Now for something technical, unrelated to web dev and Opera…
I joined my company in March 2007, and since then I've worked mostly in Oracle. Back then, I only had a theoretical knowledge of databases, but meanwhile I learned a lot in most areas, and now I'll fairly comfortable working with a big database.
In many technologies you’ll always find fun stuff to do. So know I post you a contest:
Which is the smallest possible query you can write, that'll take the longest to execute?
This is solely an exercise. I won't buy you a pack of peanuts
if you beat everyone else to the answer.
Some notes:
Good luck! The challenge is on.
P.S.: Yes, I have a possible answer and I think I already gave enough hints
I joined my company in March 2007, and since then I've worked mostly in Oracle. Back then, I only had a theoretical knowledge of databases, but meanwhile I learned a lot in most areas, and now I'll fairly comfortable working with a big database.
In many technologies you’ll always find fun stuff to do. So know I post you a contest:
Which is the smallest possible query you can write, that'll take the longest to execute?
This is solely an exercise. I won't buy you a pack of peanuts
if you beat everyone else to the answer. Some notes:
- it may work only in a specific database
- you can only use builtin functions, if any, not custom ones.
- your answer must be solely a SQL query, the name of the database the query runs and an explanation of how it works.
- doing wild Cartesian merges is not the answer, like
select 1 from dba_objects, dba_objects, dba_objects, dba_objects, dba_objects, ...
for Oracle. When you find that the query takes an eternity to execute, you can still add another dba_objects to the FROM clause and you’ll go beyond eternity, while making the query fatter and therefore beating the prime purpose: to be the smallest
Good luck! The challenge is on.
P.S.: Yes, I have a possible answer and I think I already gave enough hints


serious # Thursday, June 12, 2008 8:06:25 AM
that should be possible in ... 3 short lines imo (but I can't really prog any sql ^^)
João EirasxErath # Thursday, June 12, 2008 10:30:19 PM
But, that's a hack, and breaks the contest rules
serious # Friday, June 13, 2008 6:00:23 AM