- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Nah . Anyone with some knowledge of SQL will go through temp tables instead of creating such a major mess if their objective is indeed to retrieve all results in one client-server loop.
And if the report is even remotely half used, any sentient being will be drawn to pre-processing quickly.
Although I admit it's a lot of fun making huge queries to return the result using only one query ...
Admin
Because Hibernate is obviously the only ORM in existence.
Look at the query closer. It uses table aliases like B and M1. It's an ORM generated query. It has to be.
Admin
well well well if it isn't SQL again rearing it's ugly little head
generic constraint language (GCL) is far superior as queries are limited to 256 characters.
Admin
Time for map-reduce?
Admin
I have this image I can't shake in my mind of someone saying:
CREATE VIEW MONSTER_QUERY_VIEW AS <insert the 6 pages of SQL here>
And then the inheritors of that view wondering why it takes so long to query that 'table'... I have a further image of someone saying..no problem...this is Oracle...we'll just turn that into a materialized view..updated every ...oh...say 10 seconds...
Admin
Admin
The letter is Dutch and it says:
Beste,
Het platform werkt zeer traag en we krijgen opnieuw foutmeldingen. Kunnen jullie dit nakijken?
Following "Error encountered" and the actual query.
Translated this is:
Dear,
The platform is very sluggish and we are getting error messages again. Could you check this out?
Admin
Admin
SELECT ( SELECT.
Nested queries start like that.
Admin
I know who wrote it: Chuck Norris.
Admin
There is a theory which states that the first thing you have to do when users complain about performance, is to replace the workstations and servers with far faster ones. Another theory states that this has already happened.
Admin
But seriously,
it's probably just a badly-escaped or non-quoted smiley somewhere. Hard to pick out between all the semicolons and brackets that are supposed to be there...
;)
Admin
Anyone with some knowledge of SQL will know that.
Admin
Admin
You sir, live in a world where optimizers rock the hell out of everything.
Unfortunately, sometimes one has to work with MySQL (ouch) or with queries that land on the dark side of the optimizer (be it any optimizer really).
Of course the first step is to let the Optimizer take its shot at it.
But oftentimes, pre-processing (as in materialized views for example) is required to provide decent speed ;)
Admin
Admin
These queries are very common in ORM based architecture.
Admin
Yeah - so..? Six pages at about 68 lines per page = 408 lines. There's a query in an app that I have to maintain occasionally that's over 1800(!!!!) lines of SQL. Granted, though, they're not as dense as the lines in this query. :-)
Admin
I have seen and dealt with, one of this length. My first change sent it over the maximum length for a SPROC. Then it occurred to me to redo it in parts, and it ended up as 4 or 5 separate procedures. I can't be sure -- that was 5 years ago. The problem could be bigger than just a stored procedure. In my case the orginal author had incrementally created a rules engine of sorts, implementing too much business logic in the SPROC. First one should understand what this one is trying to do, then break it out into smaller, more focused pieces. On the way, check to see that the tables are normalized sufficiently for the application. You might even need a DB Architect for this one.
Admin
The answer too all computer questions and problems in the 1980's was "42"
Admin
Why did you have to delete my man-on-man rape story?! Do you know how long that took to write?!
I was feeling inspired, too... kicks pebble
Admin
Admin
Admin
Still is bloody 42 among those with no imagination.
Admin
It looks like DigiNotar's security plan. Since no managers understood it, they specifically told their employees to ignore security....
Admin
You have Pebbles around and your best idea is kicking her?
Do you suffer from acratia?
CAPTCHA: ideo - CAPTCHA also has a male idea!
Admin
I want the source!
Admin
Only six pages? Pfft, amateurs.
Admin
According to Chrome this query is 56 pages large.
I wish I had time to translate my 3-part blog about this some day; for now you'll have to do with Google-translate:
Part I Part II Part III
These blogentries are part of a larger concept, that's why they are actually part 5, 6 and 7.
Admin
The real WTF: Pushpins in a whiteboard?!
Admin
Almost as large as the 10K+ SQL text I found once (I know it was more then 10K because it overflowed a buffer that size) in a NYC city department.
Admin
While I agree with that statement when it comes to specific programming languages that are occasionally posted here, I don't know much any DB programming--but I can see that that is a hellspawn of a single database query. :)
Admin
"The good news is that i've isolated the problem to a single database query. The bad news is that the application doesn't consist of anything else."
Admin
the mere SIZE of the bloody SQL request is enough, I'd say... 5 pages goddamit !
Admin
that was kind of disappointing, i hoped that at least half of it would be the WHERE part, would be much more fun
Admin
I think the real WTF is the fact that the query was printed out on paper.
As stated in the text it is coming from a legacy system. This mostly implies having a little complexer data model than the usual modern Web 2.0 CRUD model on 4 tables (item, item_comment, item_attachment and user).
Admin
I think it's time to consider our last line of defense .. let chuck norris roundhouse kick the guy who wrote that datamodel ...
Admin
lol .?
Obviously the dm sucks as most datamodels used in about anything ever written . but saying older is better ?? man there's a lot of software that was written without even knowing about SQL, FK, triggers and all ...
The older the applications, the more chances of major wtf, no relational integrity, major information duplication and overall corrupted corruptable shit quality data ...
Web 2.0 my s, databases aren't meant as toys for webdevs anyway and people using the kind of DM you talk about are definitely not to be left close to a database.
Admin
Looks like typical SQL query generated by SharePoint. Lenght of this query depends on amount of data in document library. Microsoft Support say that this is perfectly normal and recommends to remove some data from library.
Admin
My personal record is 600 lines. Since I know my limitations, I wrote a perl script to help. Otherwise, I'd probably still be debugging it.
Admin
Probably this query is the result of some JOINS and subqueries between a few number of tables each one containing dozens of columns.
Captcha: inhibeo
Admin
Because then it would read
SELECT 1=1
and that's no fun at all.
Admin
Well, does if perform well ;0)
Admin
I remember one time at a social function chatting with a snooty DBA. He showed contempt when I told him I prefer to do 'JOINs by code'. I know it's a bit lazy, and I do use simple joins these days, but I know why I do it.
I should print out this article and keep it handy next time I need to defend my position.
Admin
I had to squint at the image to determine whether it was the same six-page SQL query that was taped to a whiteboard in a former workplace of mine.
No, it's not, and it's even worse. At least that one consisted mainly of a matrix of WHERE condition permutations, OR'ed together, such that the entire query only had to be evaulated in the most pessimal case.
Admin
You should nuke the site from orbit, its the only way to be sure.
Admin
I don't often say this, but Holy Cunting Fuck.
Admin
After seeing that monstrosity, I wonder if there needs to be a new entry in Guinness World Records for the "worlds longest SQL query"
Although I bet there are probably longer monstrosities generated by "frameworks" like hibernate (the abuse of such frameworks seems like a WTF in and of itself IMO)
Admin
Yes. And I have had to do that already. Massive views or fact tables for analytics. You have it.
Admin
The wine is finished will you testing... "Spanish expression"
Se te va el vino en cata