Even more complicated way



  • [url=http://forums.thedailywtf.com/forums/t/25616.aspx]Let's do it in a complicated way[/url] reminded me that I needed to post this:

    I'm not sure if this is how everything ACTUALLY transpired, but I'm guessing I'm not too far off...

    User: So, we've got our customer table, indexed by customer_id ... our product table indexed by product_id ... and our order table indexed by order_id.

    User: Now, if only we could find a way to simply attach extra information to each one of these tables which is universally accessible ... hrm ...

    Dev: Comments table! Which consists of:

    field customer_id
    field product_id
    field order_id
    field comment_text

    Dev: Brilliant! if the customer_id is filled, then that comment relates to that customer. When product_id is filled, it relates to the product. If the order_id is filled, then it relates the comment to that specific order. And we don't need foreign key constraints 'cuz ... well, that would be impossible to have all three filled in so ... yeah, FK constraints would be dumb. Ignore that aspect of it.

    User: Okay

    ... time passes ...

    User: Hey, we need a way to add extra information generically to any one of the entries in any one of records in the main tables.

    Dev: Hrm ... what do we have that is common to every table that we can glom on to? I know! COMMENTS!

    User: But we need to store specific information all at once.

    Dev: Hey, we'll widen the comment_text field and stuff all your data in there, like this!

    Item1=Value1/Item2=Value2/Item3=Value3/Item4=Value4...

    Dev: So you can read the text from the field, you can parse the data and ... Bob's your uncle ... you've stored/retrieved the data specific to the associated record! The benefit? You can store MULTIPLE COMMENTS per customer, product, or order and retrieve all the data you could possibly want. So it scales brilliantly! Oh, we need to add a field to the comments table so you can know when the entry is a comment or data. We'll call it 'type'.

    User: Okay.

    Dev: (developer pats self on the back for ingenuity)

    ... time passes ...

    User: Hey, we need to be able to query by those values that we gave you ... ranges of values and the like. Can you do that?

    Dev: Sure! I'll write a stored procedure to pull the data apart and see if it matches the criteria given in the arguments!

    User: Gee, this sure is slow.

    Dev: Yeah, Oracle is optimized for size, not for speed.



  • Crap, I forgot about the best (ahem) part:

    Dev: We're changing the way non-comment data is stored in the comments table. Instead of Item1=Value1/Item2=Value2 format, we're now going to be storing it Item1/Item2:Value1/Value2. It will help speed things up.

    User: This is still really damned slow.

    Dev: Yeah, Oracle, wot?



  • @zelmak said:

    Crap, I forgot about the best (ahem) part:

    Dev: We're changing the way non-comment data is stored in the comments table. Instead of Item1=Value1/Item2=Value2 format, we're now going to be storing it Item1/Item2:Value1/Value2. It will help speed things up.

    User: This is still really damned slow.

    Dev: Yeah, Oracle, wot?

    Oracle is TRWTF, amirite?

  • 🚽 Regular

    This isn't a complicated way. This is more accurately described as an ass-backwards way. Like if you designed a car with the steering wheel in the backseat with the shifter still on the center console in the front, and your rear view mirror behind you.



  • Yo dawg, I heard you like databases, so I put a database in your database so you can query while you query.



  • It's good he has Oracle to blame. Oracle is ... has many issues, but this db design is in a league of its own. Actually, Oracle could help speed up this thing: materialized views.



  • @Sutherlands said:

    Oracle is TRWTF, amirite?

    No... well, not in this case... but Oracle is a right recordset of WTFs at times... but that's another thread...

    @zelmak said:
    User: Now, if only we could find a way to simply attach extra information to each one of these tables which is universally accessible ... hrm ...

    Dev: Comments table!

    That began to ring warning bells for me - it wasn't clear whether the extra information was about the tables (metadata) or about the contents (data/rows) of the tables.

    Oracle actually has a COMMENT ON [ TABLE | COLUMN ] feature to add extra info in. A minor WTF is that it's stored as a table and thus requires another query to view this info (i.e. a DESC tablename won't show it) - but both SQLDeveloper and the OEM show this by default (which is why I thought them "not bad" apps).

    But yeah.. "the problem can't possibly be our flawed design or terrible implementation" causes my nervous tic.



  • @TGV said:

    It's good he has Oracle to blame. Oracle is ... has many issues, but this db design is in a league of its own. Actually, Oracle could help speed up this thing: materialized views.

    Yeah, tried that ... the command didn't finish after two days of running.



  • @Cassidy said:

    @Sutherlands said:

    Oracle is TRWTF, amirite?

    No... well, not in this case... but Oracle is a right recordset of WTFs at times... but that's another thread...

    I'm still trying to get people to understand the sameness (and thereby differences) between IS NULL, =NULL and =""

    There are days when I have to go back and test it to make sure it works the way my mental model has it.

     



  • How does this level of muddle-headedness exist? 

    How does the developer not, at some point, stop and say to himself* "There has to be a better way than this".

     

    @zelmak said:

    (developer pats self on the back for ingenuity)
     

    Oh.  Now I understand.

     


  • :belt_onion:

    @Cassidy said:

    No... well, not in this case... but Oracle is a right recordset of WTFs at times... but that's another thread...

    In fact, it's another entire forum. :D



  •  @heterodox said:

    @Cassidy said:

    No... well, not in this case... but Oracle is a right recordset of WTFs at times... but that's another thread...

    In fact, it's another entire forum. :D

    The DBMS, not so much. Its just a complicated monster that requires people with large manuals loaded Matrix style into their brain to properly use it. Although the decision to put a Java Virtual Machine in the DBMS itself I cry myself to sleep to. Its a database, not an application development platform.

    The entire other product line of Oracle however, is a giant WTF in itself. I don't think I've ever seen a more incoherent collection of outdated, non-standard and inflexible crud in my life. Imagine that you choose to adopt, say, Oracle SOA suite and you get stuck because there is no documentation and any books written are of the "you have to click here and there and you also need to do some stuff in between that we neglect to document" type. So you hire in consultants from Oracle to support you (which is the whole point of SOA of course). Who then start to google for the answers because they only know how the SOA suite worked two versions ago.

    Madness.

     


  • :belt_onion:

    @erikal said:

    The DBMS, not so much. Its just a complicated monster that requires people with large manuals loaded Matrix style into their brain to properly use it. Although the decision to put a Java Virtual Machine in the DBMS itself I cry myself to sleep to. Its a database, not an application development platform.

    Oracle seems to disagree with you, at least from what I've seen of Oracle XE with its Web interface and "Application Builder". (shudder)

    To be fair, I know next to nothing about the DBMS, except enough to create a new service instance, tablespace, user, to import, etc. to get it off the ground. (Okay, maybe I know a little.) Everything else I work with is also Oracle, though.

     



  • @heterodox said:

    @erikal said:

    The DBMS, not so much. Its just a complicated monster that requires people with large manuals loaded Matrix style into their brain to properly use it. Although the decision to put a Java Virtual Machine in the DBMS itself I cry myself to sleep to. Its a database, not an application development platform.

    Oracle seems to disagree with you, at least from what I've seen of Oracle XE with its Web interface and "Application Builder". (shudder)

     

    I know :( That I have no problem with. What I do have a problem with is whole armies of "PL/SQL developers" that blindly do what Oracle tells them is the truth and try to build whole Java applications in Oracle procedures, with all the madness of loading additional jars into its seriously outdated JVM as well. I've seen people trying to load APIs in there to work with office documents. Argh!

    @heterodox said:


    To be fair, I know next to nothing about the DBMS, except enough to create a new service instance, tablespace, user, to import, etc. to get it off the ground. (Okay, maybe I know a little.) Everything else I work with is also Oracle, though.

     

     

    You know more than most ;) It becomes nice when you start to do slightly more advanced stuff like two-phase commits and whatever. When your hosting company likes to pull out cables at exactly the wrong moment, you may end up in a position where there is no application client running, there are no active sessions in the database but the database still reports that records are locked by another user - which does not exist. What you have is a transaction that was neither committed nor rolled back and Oracle happily keeps track of it until the end of time, until a DBA performs a manual rollback on the transaction.You don't read that in Oracle for Dummies I can tell you.

    User rights, another fun thing. You can create situations where under user X things perform like a charm and under user Y things perform like a dog - I'm talking a difference of 10 seconds and 2 hours. Reason: based on certain rights Oracle may or may not be able to create a proper execution plan. It works anyway but really, really slow.

    I have to stop, it is not good for my blood pressure to dig up such memories.

     



  • @erikal said:

    The DBMS, not so much. Its just a complicated monster that requires people with large manuals loaded Matrix style into their brain to properly use it.

    That.

    I can't speak for Horricle's other offerings, but the RDBMS part of it is quite a complex beast that requires not only dedicated personnel to wrestle with it, but sacrificing the required amount of virgins whilst dancing clockwise by the light of the moon, dressed in funny robes. The biggest complaints I hear against it are from those without the ability (or unwillingness) to absorb said matrix and hope clicky-pointy experimentation will produce the required results.

    @erikal said:

    Although the decision to put a Java Virtual Machine in the DBMS itself I cry myself to sleep to. Its a database, not an application development platform.

    Well.. it was. Orabble 8 quickly became "8i", the "i" bit meaning "interwebz". They appropriated Apache+Tomcat and - rather than trying to move the database into a webserver - did it the other way around, wrapping the webserver part around the DB like a serial killer wearing the skins of its victims.

    "it rubs this notion into /oracle/bin"

    Given a web-based interface now (isqlplus, OEM, etc), Oracle's increased use of Java kinda makes sense to include a JVM. The advantage is that there's no jumping through hoops trying to sort out your pre-requisite JRE to get the RDBMS up and running, it comes complete. The disadvantage is potentially duplicate java environments, and inability to apply patches to their insular JVM without buttfucking their proprietry Java Containers and breaking your OEM.

    Now, if only Oracle actually owned and controlled Java, things should work bett.... oh.. hang on... 



  • @Cassidy said:

    "it rubs this notion into /oracle/bin"

    I laughed so hard I might have just had a small accident


Log in to reply