Friday, June 6, 2008 3:30:47 PM
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.
- 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