THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Denis Gobo

SOT: I found a new 'worst query'

Before you ask, SOT means Slightly Off Topic  :-())

Take a look at Hi, I need help on simplyfying this Update query!

I don't even want to count the nested SELECTS, The query is 688 lines long, somehow schadenfreude enters my mind.

Published Thursday, March 20, 2008 4:31 PM by Denis Gobo
Filed under:



James Luetkehoelter said:

While I've seen worse (seriously), that's the most bizarre one posted I've ever seen...

March 20, 2008 4:24 PM

Paul Nielsen said:

and this, dear friends, is the reason why the physical schema is the basis for performance. I'd bet that the schema designed for both normalizatrion AND query performance would have been significatly easier to query and the poor developer would not have been forced to wrtite such a wild query. Don't blame the query develoepr. Blame the data modeler and the architect.

But Denis, I don't see how this post is SOT - seems right on topic to me.

March 20, 2008 5:02 PM

Will Harris said:

You guys should check out some of the auto generated queries in Ruby on Rails.  I've seen 4000 query auto generated monstrosities with thousands of lines reduced to 10 lines!

March 21, 2008 4:54 PM

noeld said:

Let's just say that I can't disclose what I have seen on "generated SQL" in the past. It blows away that query "easily"

March 24, 2008 1:00 PM
New Comments to this post are disabled

About Denis Gobo

I was born in Croatia in 1970, when I was one I moved to Amsterdam (and yes Ajax is THE team in Holland) and finally in 1993 I came to the US. I have lived in New York City for a bunch of years and currently live in Princeton, New Jersey with my wife and 3 kids. I work for Dow Jones as a Database architect in the indexes department, one drawback: since our data goes back all the way to May 1896 I cannot use smalldates ;-( I have been working with SQL server since version 6.5 and compared to all the other bloggers here I am a n00b. Some of you might know me from or even from some of the newsgroups where I go by the name Denis the SQL Menace If you are a Tek-Tips user then you might know me by the name SQLDenis, I am one of the guys answering SQL Questions in the SQL Programming forum.

This Blog


Privacy Statement