- 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
saya sangat prihatin dengan apa yang sedang di alami.
Admin
Admin
Admin
Can someone just take that query to Mordor, and toss it in the firs of Doom?
Admin
Admin
Perhaps he's hoping it would confound the forces of evil... might work, I'm sure it would confound just about anyone who looked at it.
Admin
Actually it's easy. I was landed with a piss-ridden Access arse end of a system, 15 years in the making. I traced one query and found that it relied on >200 other queries. The system had 2000 records and would regularly take 30 minutes to run a report. It happens when you give a complex IT system to a guy in marketing because 'hey - I've done this at home and it's really easy yeah!'.
Admin
There is a cure. Redesign entire schema and rewrite all statements.
Admin
Admin
A six page query isn't necessarily a problem if it's reasonably well-structured. You should be able to find several blocks (unioned sections or subqueries) in it that you can highlight and test separately.
If that query was well-formatted, though, it would probably be about fifteen pages.
Admin
I have the misfortune of working with a certain sailboat enthusiast's software and, sad to say, queries like this are per normal from that company.
Capta: abigo (related to the above-referenced company)
Admin
Against Stupidity... ...The Gods Themselves.... ......Contend in Vain.
Admin
Admin
Die Email sieht verdachtig nach germanischen ... Vielleicht (wie die Deutschen tun) es muss nur ein paar sehr lange Wörter (oder Tabellennamen)
That is, when German's haven't got a word to describe something, they run a description together into one word, so they tend to have long words for some things. Perhaps all the tablenames were such long words....
Admin
Blasting this from space is not enough. One needs to call in a tactical nuclear strike with a remote drone, which ought to obliterate enough to get it off of the face of the earth.
Of course, TRWTF is probably SQL in the first place. This company should be relegated to using RPG-II for the rest of time.
Admin
Admin
I want to see the execution plan. Please.
Admin
Admin
End of plan.
Admin
The reason this doesn't happen more often isn't because it's a WTF. It's because whoever's name is on the code only gets credit for writing one line of code.
Admin
And imagine how long it takes to compile. I saw an 86 table join that took 3.5 minutes to compile (ran like a clock afterwards though). This monster could beat that easily I'm sure.
Admin
It could be worse . . . at least it is not a regex
Admin
I wrote a query like that once. It was for a report that the business requested. It was the same query unioned about 12 times (one for each of the cases they had) where each query had about 30 joins to get the requested data. It also took about 30 minutes to run, but did do a job that 4 people used to take a week to do. I printed it out once and it took 8 pages (nicely formatted though).
I was so proud of it when I finished I ended up stripping all newlines inverted the text colour so it was white on black and saved it into an image which I used as my wallpaper for a while.
Admin
So to fix this query they merely need to do some simplifylongquerybyrestructuringandremovingredundancy, or some similar.
Admin
Aye, Robot.
Admin
Admin
Sound like business as usual to me, nothing to see here folks move along...
sino: a conjunction of sin and no, count me out.
Admin
"SELECT ( SELECT" Nothing necessarily wrong with that part.
Admin
Not like 98% of the developers that read this site ever give a crap about execution plans...
Admin
A query like that has to grow over time. It starts out as a complicated query, then someone spots a bug in a certain case or wants to add a field. Instead of fixing the query and risking breaking something else, it gets wrapped in parentheses as a subquery, because that is "safer". Repeat 10 or 12 times and you have a 6 page query.
Admin
There IS a reason for programmers doing maintenance project have a temptation to rewrite everything from scratch.
Admin
Admin
This is nothing. Teradata database and tools handle queries many times longer than this.
Admin
Complex programs should be complex. They cannot be composed out of simple 'Hello World' snippets. Work harder, and someday you will grow to that level.
Admin
Actually, it's Dutch - probably Flemish, given the way some names are spelled.
Which brings me to another point: what happens when Monique Dewandelaer leaves the company?
Admin
I can beat this. I have a 50 pages printout of a SQL statement that was still running after 48 hours. (Hibernate...)
Admin
I have investigating a marginally less nasty legacy query on my list of things to do for one project. It provides the data for the dashboard page of the admin side of a website. One query to count the total number of users, users active in a given window, countries represented, sales in different categories, this, that, and the other. Unfortunately there is no documentation, and the client can't remember the precise details of half of the values it gets back ("Does this one include test users or not?") so it's probably going to be a case of gathering requirements and redoing it largely from scratch as a dozen or so queries stitched together in application code, using the subqueries of the existing SP as a guide.
Admin
Admin
Admin
This is what happens when SQL turns fully sentient and tries to crush the souls of us puny humans. I also think that you can fix something like that. It's just a matter of beautifying the code so that it is human readable and just take it one logical step at a time. Then you take two weeks of leave and a few visits to a shrink to recover.
Admin
Admin
Only mad scientist can repair something made by another mad scientist...
Admin
Well, only yesterday I had to deal with a ten-way join in Oracle, with four of the joined 'tables' actually being 'with' clauses, one of which had another four-way join.
And no, it can't be made any simpler. I blame the supplier.
Admin
Yes Most probably it is Hibernate
Admin
You need a SQL programmer to achieve that.
Regular application programmers might add an outer join or a subquery. (Some adventurous programmers might add both.) If it gets more complicated, they'll add some application code to link several queries.
There are two ways to end up with such a query:
A query generator.
A database developer. They insist of getting all data in a single query, no matter how complicated it gets.
(BTW, I'm pretty sure I know P. Vandamme, and I worked on that project. It's in Dutch - Belgium actually.)
Admin
Admin
Confusing feelings of arousal?
Admin
Admin
Considering that the query that long probably be deeply nested, even if you manage to beautify it, it would be severely indented that it wouldn't make a difference in readability anyway.
Oh yeah, I don't think it will take 15 pages. My opinion is that it probably takes the whole wall. Hah!
Admin
Oh, come on. If you're just going to misspell words to achieve the illusion that English is not your first language then I suggest not applying that to the name of a software product that after an install shows up on on your start menu as 'Crystal Reports' and would therefore be right in front of your nose.