 |
Blogs Toad and Database Commentaries |
Toad World blogs are a mix of insightful how-tos from Quest experts as well as their commentary on experiences with new database technologies.
Do you have a topic that you'd like discussed? We'd love to hear from you. Send us your idea for a blog topic.

 |
 |
|
|
 |
 |
Location: Blogs
Mike Ault's Blog
|
|
| MikeA |
Wednesday, May 30, 2007 9:32 AM |
I’ve been searching for a definitive answer to the question: “What is the cost of poor database design?” No doubt you have all seen the cost/benefit graphs for fixing application problems and the pyramid showing how up to 90 percent of performance issues in a running database are SQL and index related, but what about the cost of building an application on a poorly designed database that forces poor SQL usage?
No doubt most of you have seen them; databases ported directly from a flat file or legacy non-relational system where no concept of normalization was ever applied. Databases deliberately designed to be flat files, databases designed with deliberate multiple recursion in tables (“flex fields”), databases where the burden of referential integrity was left to the application, and databases that make no use of advanced features such as index only tables, partitioning, global temporary tables and materialized views (or summaries if you prefer.) Don’t even get me started on the forced use of improper technology such as object oriented design, VARRAY and nested tables where they shouldn’t be used.
It is surprising with the predominance of these types of table design flaws on basic tables in relational databases that a study somewhere hasn’t posted the cost of these bad design decisions on TCO for applications. Of course maybe it is so predominant that everyone just assumes you are starting with a badly flawed database design.
What is really sad is that with the application of a few design principles such as normalization and then selective denormalization and the proper use of advanced features truly performance oriented databases could be built. With simple tools such as the Toad® Data Modeler improper designs can quickly be corrected. Use of the indexing and partitioning wizards available in Toad would also help to show where some of the advanced features can be applied to a design.
Of course in these days of “The 2-Day DBA” it is asking a bit to expect DBAs to be fully conversant on all new features, especially as they apply to design of a database, not to mention expecting designers and application coders to understand them.
So what can be done? I suggest all DBAs read over the new features guides and references and concepts guides to get an understanding for their databases what features are available. Managers need to get DBAs involved with the application design from the start, not wait to call them when it performs badly. Finally, if you aren’t familiar with normalization and denormalization, get some of the classic design texts that will provide you a good basis for these concepts and study them. If we apply good basic design rules to our systems and use performance enhancing new features there is no reason why the database should be the source of performance issues. |
| Copyright ©2007 Quest Software Inc. |
| Permalink |
Trackback |
Comments (4)
|
By Norm on
Thursday, June 07, 2007 5:19 AM |
I'm not the best database designer in the world, I admit. What really gets my goat is the following :
* Data types being used incorrectly - DATEs stored in a VARCHAR2 for example.
* Default values that upset the CBO, DATEs again, set to '31/12/9999 23:59:59' to indicate 'no date yet' rather than using NULL.
* Improper normalisation - Stuff like a table with columns STUFF_1, STUFF_2 and so on, when these should be a separate table.
* And, worse, a single column holding multiple values - STATUS column for example holding all status codes that a row has 'passed through'' and looks like '**STAT_1**STAT_2**STAT_3**STAT_4**...**' and using an INSTR to find the status required. AAAArrrrgghhh!
And I've seen all of the above in one single application, which also had no binds anywhere. Still, kept me in work for over a year sorting it all out !
Cheers, Norm. [TeamT]
|
|
|
By mikerault on
Thursday, June 14, 2007 5:40 AM |
Ah yes, "flex fields" as I mention above can really kill performance. I haven't seen a default value cause optimizer issues, can you explain further? usually default values are used to help with indexing issues and nulls.
Used to be it was difficult to add or drop columns so the additional columns were added to allow for future needed columns, however some get ridiculous with it.
Unfortunately one of the worse offenders with all of the above is Oracle Applications themselves; with such poor examples it is no wonder some developers think they are ok to use them.
|
|
|
By Norm on
Thursday, June 21, 2007 2:29 AM |
Hi Mike,
you asked for an example of a default value causing optimiser issues. How about this one :
The application designers decided that a NULL in a date column was not allowed. This then left the problem of what to use to specify that the particular date column had 'no value', so a default of '31/12/9999' (dd/mm/yyyy) was used.
The optimiser sees this and assumes that because it is not null, it must be a valid value and so includes that dummy value in it's caclulations. Without histograms to show the real spread of values then having too many of these non-dates caused FTS rather than indexes being used.
Change to NULL instead, optimiser no longer fooled, indexes used. Would probably have woprked (equally?) with correctly gathered histograms, but the point I was making was "if there are no values, then don't put something in by default that *is* a value" as it can lead to trouble.
Cheers, Norm. [TeamT] |
|
|
By mikerault on
Monday, July 02, 2007 11:01 AM |
I concur if no histograms were generated it may cause an issue. Unfortunately dates are a special case. In earlier editions of Oracle null could cause issues, in the latest releases the optimizer can sometimes "think" around the null to avoid issues.
Mike |
|
|
 |
 |
|
 |
|
 |
|
|