| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |
One line wrapped by the printer is still one line. |
Re: The Query of Despair
2011-10-24 10:37
•
by
Ken B.
(unregistered)
|
You must be new around here. The problem is on line 42. |
Line breaks don't count... EDIT: oops, boog beat me to it... DAMN YOU BOOG!!! |
Re: The Query of Despair
2011-10-24 10:40
•
by
Bob
(unregistered)
|
Please try to show some sensitivity. I had a son who was *censored*, and let me assure you: it is no laughing matter. |
Re: The Query of Despair
2011-10-24 10:44
•
by
Daniil S.
(unregistered)
|
I wish I had a dime for each time I had that experience |
|
As the BASIC interpreter would say: ?REDO FROM START
|
|
They must be using Magento...
|
That's exactly the direction I was headed, right down to the HA. |
|
Looks like a great query for EXPLAIN.
What kind of database is configured with a statementbuffer this big? |
|
Presented to you by the movement, "Occupy Query Engine."
|
|
This query is bigger than my mother-in-law...
|
Re: The Query of Despair
2011-10-24 11:09
•
by
Ratnoz Bassackwards
(unregistered)
|
|
You've been in programming 20 years and don't know what a *query* is?
I think I smell some BS, but just in case I'm wrong about that, here goes: It's ONE friggin' SQL statement that's MANY pages long. |
Yes. The only way it could possibly be worse is if they used column and table names that were keywords: SELECT SELECT, INTO, FROM, ON FROM JOIN JOIN INTO ON SELECT = INTO AND ON = UNION (DB2 SQL has no reserved words; given the right table definitions, the above is legal!) |
*ba dum tsh* |
Re: The Query of Despair
2011-10-24 11:12
•
by
trtrwtf
(unregistered)
|
I read "Magneto" at first, and I thought, yeah, he's the one who erases disks, isn't he? PERfect. |
|
Is there anything you could do *other* than just rewriting the damn thing?
|
|
Pleasant little exercise. Great fun. On a par with replacing a DB table full of hardwired SQL statements, very similar but with subtle differences, with a stored procedure that built the SQL dynamically. Utterly unmaintainably impossible to read, but saved an entire table.
|
Re: The Query of Despair
2011-10-24 11:18
•
by
trtrwtf
(unregistered)
|
Find the guy who wrote it and keelhaul him? |
Re: The Query of Despair
2011-10-24 11:20
•
by
fardle
(unregistered)
|
FTTFY captach: iusto... iusto care about efficiency, but now that nobody else does, why should I? |
We all know the reason why. Because someone wrote a huge query for some "complex" task and it became taboo to fix as the years went on out of fear of breaking something if someone decided to refactor it and pare it down. |
Re: The Query of Despair
2011-10-24 11:26
•
by
Sadly, I've Seen This
(unregistered)
|
I doubt a human wrote this SQL. It looks like a program-generated query. I could list some programs at our company that make such crappy SQL. We have a vendor whose software creates just that kind of SQL query. It has that "SELECT (SELECT COUNT(*)...)," sub-query in the SELECT-list pattern. It writes multiple JOINs to the same table to get (key, value) pairs. We hired an Oracle consultant firm to tune that vendor's SQL. Their response was a firm "Re-write all the queries." |
|
Take off and nuke the site from orbit; it's the only way to be sure.
|
Re: The Query of Despair
2011-10-24 11:29
•
by
someone else
(unregistered)
|
My Stars.... Its full of Gods!!! |
They must be crazy! |
|
Came across a query like that once when asked to track down a bug in a report.
Spent a couple of hours reading through it before locating a comment with the Lead Dev's name on it - he was in the office the next day so I asked for his help on it. "Oh don't try and debug THAT" he said. "I just sat down one night and dumped my brain out in one big splat of SQL - will probably have to do it all again to fix this issue". |
Re: The Query of Despair
2011-10-24 11:40
•
by
The "Z-Guy"
(unregistered)
|
Then you could feel like a whore, too. |
|
That's no query. It's a space station.
|
|
Curses! Yet another failed attempt to summon the almighty Cthulhu.
|
|
Ahh, so this is what happens when you use LINQ to SQL.
|
Re: The Query of Despair
2011-10-24 11:49
•
by
Steve The Cynic
|
That only explains why it is *still* that big. HTF did it get that big in the first place? Complex tasks aren't (shouldn't be) *that* complex. After all, how can you possibly know you have it right? And how do you manage to even write syntactically valid SQL for something that big? |
|
Meh .. why do people even try to debug that kind of crap .. you take the output, reproduce it with "saner" SQL and be done with it, it'll always be shorter and less of a mental health hazard than trying to deal with the squidmonster ...
|
|
Obviously, the solution is removing the query and starting again.
It's just one query. |
Re: The Query of Despair
2011-10-24 12:16
•
by
Chris
(unregistered)
|
Ow, my eyes. At least in SQL Server you have to enclose field names if they're reserved words, e.g. select [select], [as] from [from] |
Re: The Query of Despair
2011-10-24 12:17
•
by
GrammerSnarker
(unregistered)
|
|
Let Alex have a the life, we humans can parse it.
|
Re: The Query of Despair
2011-10-24 12:20
•
by
someone else
(unregistered)
|
|
Just one query? This thing has more selects than i care to count.
This might even reach a kind of perverse nirvana where it doesn't deviate at all from the median frequency of SQL keywords used in an average project for selects. All joined together. |
copy-paste-copy-paste-copy-paste In your over 20 years of programming experience, have you really never watched a new programmer clumsily "write" their first big SQL query? |
Thanks. Now I hate DB2 even more. |
Re: The Query of Despair
2011-10-24 12:30
•
by
Mojo Monkeyfish
(unregistered)
|
|
Ironically, YAGNI.
|
|
As a sociopath, I would like to imagine that this query returns a result set of two columns: the first column contains a unique id number and the second column contains some CSV or XML. The query collects all possible data you could be looking for in all possible forms you could want it. Any time one wants to look up anything in the database, just run this single query and get the row with the id number of the information you want. It will be right there, in easy-to-read CSV/XML form.
No more error-prone writing of multiple queries! Just one, solid query that will receive rigorous testing as everything depends on it! Brillant! |
|
All you need are my butt cheeks to crack this nut.
|
Re: The Query of Despair
2011-10-24 12:39
•
by
PedanticCurmudgeon
|
How do you know it failed? |
Re: The Query of Despair
2011-10-24 12:43
•
by
seriously?
(unregistered)
|
|
Seriously? You can't figure out why an SQL query that is 6 full pages when printed would be a problem?
|
Re: The Query of Despair
2011-10-24 12:45
•
by
This is not my real name
(unregistered)
|
|
Why are the worst WTFs on this site always in Dutch...
|
Re: The Query of Despair
2011-10-24 12:59
•
by
Rfoxmich
(unregistered)
|
I doubt it. Captcha "inhibeo" I inhibeo you from writing crap like that. |
What do you expect from a country full of dikes that little boys have to save from bursting, by plugging them with their thumbs? ;) |
Re: The Query of Despair
2011-10-24 13:03
•
by
I prefer both Microsoft's portable mp3 player and my sister
(unregistered)
|
I <3 your ;) Or maybe I 8=====D~~~ your E(o)3 |
|
none of you peepul have working experence with Kristal reports. That's one softwear that will write complex querees and mess with your mind all time.
|
Re: The Query of Despair
2011-10-24 13:40
•
by
Nagesh
(unregistered)
|
Could be. Populous on the other hand is awesome! |
Re: The Query of Despair
2011-10-24 13:55
•
by
Tangurena
(unregistered)
|
I've done a couple report queries over the years that were about half this length. The worst took about 45 minutes to run as it hit multiple servers to do all sorts of aggregates for various columns. About a dozen columns were subqueries themselves. It was also used for billing so it had some crazy logic like "which customers of type X have not submitted a transaction via partner Q during the last calendar month" (with the reasoning being that partner Q would subsidize them if they did 2+ transactions in a month, otherwise we charged the customers). |
|
My only hope is that a program generated most of this query and not an actual person. I would laugh if the error is because the query is so long that the program running it is truncating part of the query off, and it just happens to truncate in such a way that the query can still be run.
On a side note I do not think I could even test or try debugging the sql query by running it from a cmd line without it running out of buffer. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Next » |