• (cs)

    Rather than a "Wooden Table", this photograph was taken on a WHITEBOARD.

  • Spivonious (unregistered)

    ...

    That's insane.

    captcha: populus - boring game

  • trtrwtf (unregistered)

    Probably true.

  • (cs)

    Fr1st two words: SELECT ( SELECT. That's already very promising.

    Also, not fr1st!

  • Matt (unregistered)

    Holy Fuck, no human could write that!

  • (cs)

    I don't get it. So much crap posted on The Daily WTF is for initiates only with no explanations for those of us with over 20 years programming experience who lack that finite bit of knowledge that makes YOUR WTF understandable.

  • Nagesh (unregistered) in reply to Matt
    Matt:
    Holy Fuck, no human could write that!
    You are being corect: this is most likly Hibarnate.
  • (cs)

    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.

  • Ale (unregistered)

    I've already seen a ten-page-long query. And it was used in a real application. Thankfully, I've never had to debug it.

  • olaf (unregistered)

    Why not tidysql the query instead of printing it out unreadable? (or printing it out at all)

  • (cs) in reply to frits
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
  • trollsolo (unregistered) in reply to Nagesh

    I've seen many things do this. Use a beautifier. Sure it'll use more paper, but stable it together and it's worth it.

  • (cs) in reply to olaf
    olaf:
    Why not tidysql the query instead of printing it out unreadable?
    Because it would have made it longer.
  • dave (unregistered)

    I feel for the his colleague.

  • Damien (unregistered)

    The problem is on page 4, line 27. Isn't that obvious to everyone?

  • apaq11 (unregistered)

    The worst part is I looked at that query and was like, oh hibernate probably generated that query. Then I looked again and from what I can see it doesn't look like it's aliasing tables/fields the way that hibernate would. This leads me to believe that someone probably wrote this...

  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
  • (cs)

    Seen a query of this size that was generated by an alien logic that my colleague wrote... and strangely enough, it was the only possible way to get the desired result as the DB structure was just as alien.

  • trtrwtf (unregistered) in reply to frits
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.

    I'm feeling like I know more about frits than I want to know right now.

    I'm off to have a shower.

  • (cs) in reply to SilentRunner
    SilentRunner:
    I don't get it. So much crap posted on The Daily WTF is for initiates only with no explanations for those of us with over 20 years programming experience who lack that finite bit of knowledge that makes YOUR WTF understandable.
    Well, I have over 20 years' programming experience, and evidently I have the necessary piece of knowledge. In fact, it's in the article. The picture shows a hard-copy of *one* SQL query. HTF does an SQL query get complex enough to be spread over six pages?
  • (cs) in reply to trtrwtf
    trtrwtf:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.

    I'm feeling like I know more about frits than I want to know right now.

    I'm off to have a shower.

    That's more than I wanted to know about your relationship with frits...

  • (cs) in reply to frits
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
  • kjordan (unregistered) in reply to apaq11
    apaq11:
    The worst part is I looked at that query and was like, oh hibernate probably generated that query. Then I looked again and from what I can see it doesn't look like it's aliasing tables/fields the way that hibernate would. This leads me to believe that someone probably wrote this...
    I'm not even sure what kind of query you would have hibernate doing that it would do it like that. Hibernate seems to do it less in big queries now, but you might have more running to populate your objects if you don't have lazy loading turned on for relationships.
  • SuperQuery (unregistered) in reply to Steve The Cynic

    I've got one. Try being told to pull out info from 245 tables that all need to be related. To create another unassociated, mess of a db with..... :( Although my is spaced a lot better :)

  • (cs) in reply to C-Octothorpe
    C-Octothorpe:
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
    If you've had the mispleasure of seeing that scene, no matter how long and far you try to stuff the memory, the pain will always be there.
  • (cs) in reply to frits
    frits:
    C-Octothorpe:
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
    If you've had the mispleasure of seeing that scene, no matter how long and far you try to stuff the memory, the pain will always be there.
    Seriously guys, I haven't seen that movie yet. Could you please put spoiler tags around this?

    Then again, at least I've been warned now.

  • Bas (unregistered)

    Awesome.. the mail reads "The platform is very slow and produces a lot of errors. Could you check this?"

  • (cs)

    If this is Orcle, Tomas Kyte can certenly help with it.

  • Anon (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    HTF does an SQL query get complex enough to be spread over six pages?

    I'd bet on generating reports that require aggregate functions while not actually using any aggregate functions.

    My own record in reporting is a page and a half on one SQL-query (unbeautified). 7K of text, optimized the heck out of, to run in under two seconds every few hours.

  • someone (unregistered)

    Oh my god... it's full of stars.

  • I. G. E. (unregistered) in reply to The poop of DOOM
    The poop of DOOM:
    frits:
    C-Octothorpe:
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
    If you've had the mispleasure of seeing that scene, no matter how long and far you try to stuff the memory, the pain will always be there.
    Seriously guys, I haven't seen that movie yet. Could you please put spoiler tags around this?

    Then again, at least I've been warned now.

    I have seen it, and I haven't a clue what scene they may be talking about. In a Van Damme movie, what kind of censored even notices anything except the fighting scenes?

  • (cs)

    http://tinyurl.com/QueryOfDespairReaction

    That's the first thing that sprung to mind when I saw that printout.

    Also, they need a highlighter to make it have some more colour to discern various bits of it.

  • (cs) in reply to I. G. E.
    I. G. E.:
    The poop of DOOM:
    frits:
    C-Octothorpe:
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
    If you've had the mispleasure of seeing that scene, no matter how long and far you try to stuff the memory, the pain will always be there.
    Seriously guys, I haven't seen that movie yet. Could you please put spoiler tags around this?

    Then again, at least I've been warned now.

    I have seen it, and I haven't a clue what scene they may be talking about. In a Van Damme movie, what kind of censored even notices anything except the fighting scenes?
    I'm sorry that I don't distinguish one type of fiction and choreography from another.

  • Canthros (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    HTF does an SQL query get complex enough to be spread over six pages?
    Regrettably, my second or third thought was, "I really hope that wasn't one I had to write." After another, closer look, it isn't (I never had to write anything against a schema with Dutch table names).

    I wound up writing a hideous abomination of an 8+-way union, once. IIRC, it was a bunch of reporting queries that needed to be squished together, so the individual queries weren't terrible, there were just a lot of them.

    It's also possible that it's a bunch of MS Access queries that have been strung together, which might explain the SELECT (SELECT thing at the start. Access has traditionally had some curiously quaint restrictions on query size that tends to turn any even moderately complex query into a maze of small, twisty queries, all alike.

    Finally, it could just be that whoever created that thing had no idea what they were up to.

  • Anon (unregistered) in reply to Anon

    Selffix: aggregate functions = somewhat complex aggregate functions, like AVG .. OVER ... RANGE BETWEEN .. etc.

  • (cs) in reply to The poop of DOOM
    The poop of DOOM:
    frits:
    C-Octothorpe:
    frits:
    C-Octothorpe:
    frits:
    Looking at that image gave me a similar feeling to watching VanDamme dancing in the movie Kickboxer.
    What, nausea?
    I think the colloquial term is "douche chills".
    I totally forgot about that scene. Thanks for undoing hundreds of hours of therapy frits...
    If you've had the mispleasure of seeing that scene, no matter how long and far you try to stuff the memory, the pain will always be there.
    Seriously guys, I haven't seen that movie yet. Could you please put spoiler tags around this?

    Then again, at least I've been warned now.

    Just remember: what has been seen, cannot be unseen.

  • D (unregistered)

    There is no hope. The best you can do is put the beast down. Burn the document, wipe the drives, torch the building... Oh, and flush the site with holy water just to be on the safe side.

  • Anon (unregistered) in reply to Canthros
    Canthros:
    a bunch of MS Access queries

    No. Please, just - no. horrified

  • (cs)

    That's pretty bad, but in my experience such queries are usually a result of

    1. lack of SQL know-how and
    2. extensive CTRL+Cing-and-CTRL+Ving.

    This massive beast is most likely a handful of copies of several smaller-but-ever-so-slightly-different beasts all JOINed and UNIONed together. Example:

      SELECT (bunch of crappy columns)
      FROM   (bunch of crappy tables)
      WHERE  (bunch of crappy conditions)
      AND    item_type = "XYZZY"
      UNION
      SELECT (the same crappy columns)
      FROM   (the same crappy tables)
      WHERE  (the same crappy conditions)
      AND    item_type = "PLUGH"
      UNION
      ...
    

    I bet if you format it, it'd take (at most) only a couple months and all your remaining sanity to refactor it into something mentally-parsable.

  • (cs) in reply to boog
    boog:
    That's pretty bad, but in my experience such queries are usually a result of 1) lack of SQL know-how and 2) extensive CTRL+Cing-and-CTRL+Ving.

    This massive beast is most likely a handful of copies of several smaller-but-ever-so-slightly-different beasts all JOINed and UNIONed together. Example:

      SELECT (bunch of crappy columns)
      FROM   (bunch of crappy tables)
      WHERE  (bunch of crappy conditions)
      AND    item_type = "XYZZY"
      UNION
      SELECT (the same crappy columns)
      FROM   (the same crappy tables)
      WHERE  (the same crappy conditions)
      AND    item_type = "PLUGH"
      UNION
      ...
    

    I bet if you format it, it'd take (at most) only a couple months and all your remaining sanity to refactor it into something mentally-parsable.

    Which is exactly why he shouldn't try to RE the bitch and should just rewrite it from scratch based on specs (HA!) or expected behavior...

  • WC (unregistered)

    Am I the only one here that wishes he (or she) could attempt to clean that up and then refactor it? :D

    Inside that ugly mess is some beautiful code, just trying to come out.

  • Ross (unregistered) in reply to D

    Nuke the site from orbit. It's the only way to be sure.

  • Canthros (unregistered) in reply to Anon
    Anon:
    Canthros:
    a bunch of MS Access queries

    No. Please, just - no. horrified

    I think I'm wrong about that, anyway. Looks like the beginning is caused by the first column being an aggregate (count) in a correlated subquery against a different table.

    But, yeah. When I was decoding Access queries, many oaths were sworn and curses invoked.

  • Daniil S. (unregistered)

    Just out of sheer curiosity, I really wish to see this query in full.

  • (cs)

    Obligatory grammar snark:

    "I don't think anyone can help me," the his colleague wrote.

    CHOOSE ONE OR THE OTHER ALEX.

  • trtrwtf (unregistered) in reply to Daniil S.
    Daniil S.:
    Just out of sheer curiosity, I really wish to see this query in full.

    As a wise man once said, "Just remember: what has been seen, cannot be unseen."

  • (cs)

    On the plus side (for Jeroen's colleague), since this SQL was submitted as a CodeSOD instead of a Representative Line, I assume it implies some semblance of sanity in the rest of the source.

  • trtrwtf (unregistered) in reply to Zylon
    Zylon:
    Obligatory grammar snark:

    "I don't think anyone can help me," the his colleague wrote.

    CHOOSE ONE OR THE OTHER ALEX.

    There's only one Alex writing this, grammar boy.

    (I gots to keep up my grammar Nazi rep, yo)

  • My Name Is Missing (unregistered)

    I once helped out on a project with a SQL query that long that took 70 seconds to complete on average (not good for a web app!). I fixed it by extracting the relevant data from the database and doing the search in RAM, reducing the query time to sub second. Some things are best not done with a relational database.

  • (cs) in reply to boog
    boog:
    On the plus side (for Jeroen's colleague), since this SQL was submitted as a CodeSOD instead of a Representative Line, I assume it implies some semblance of sanity in the rest of the source.
    To apply for Representative Line, it should be a line, not six pages.

Leave a comment on “The Query of Despair”

Log In or post as a guest

Replying to comment #364173:

« Return to Article