If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Chit Chat > Now I understand *why*

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-14-07, 19:44
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Now I understand *why*

I am pretty much a novice when it comes to database modeling and have had an opportunity to model a rather large database with about 90 tables. Well.. I say large because I couldn't begin to fathom anybody creating something larger without going absolutley bonkers.

Anyway, I figured I would share some of my experiences and things that were not clear to me before about why software developers and data modelers really could not see eye to eye.

The datamodeler wants to normalize the data, and rightfully so. The developer wants to develop the program with the least amount of work, stress and headache. Since I am doing both, I am really beginning to understand why throwing all of the data into a couple of tables appears very tempting. Although I would never do that, it really is tempting at times.

I am seeing that when data is normalized, the sql to bring it all back together again becomes quite a task and gets really involved. I would venture to say that had I not normalized my data I could have probably finished my design by now. Its an inner struggle really.

Frank
Reply With Quote
  #2 (permalink)  
Old 08-14-07, 20:07
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
yes its quite possible that you could have knocked up a physical design which would meet the current requirements....

..providing of course
....you had a comprehensive full discovery of facts
....you were confident that your users /customers were not going to change their minds, processes or business model
....you could walk away from the project after completion and 'know' that any problems would never ever come your way.

the whole point of designing the schema is to support the way the business works right now AND in the future.. its pointless deploying a design which works right now, but fails in the near future as the business changes. Its dumb to design something which works now, but falls apart over the life of the application
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 08-14-07, 20:14
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Quote:
Originally Posted by healdem
the whole point of designing the schema is to support the way the business works right now AND in the future.. its pointless deploying a design which works right now, but fails in the near future as the business changes. Its dumb to design something which works now, but falls apart over the life of the application
Healdem, I am assuming that by this you are referring to the normalization of data.
Reply With Quote
  #4 (permalink)  
Old 08-15-07, 08:54
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
By all means, do not normalize your data...I mean, there is only decades of study based on the relational model.

Make sure your developers have it as easy as possible....

So when the f up the data, you have the luxury of correcting all of the data anomalies

Good luck
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #5 (permalink)  
Old 08-15-07, 09:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by fjm1967
...I am really beginning to understand why throwing all of the data into a couple of tables appears very tempting.
denormalize 90 tables into a couple??

i would like to see you try that
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 08-15-07, 11:04
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Don't think it can't be done. Ever worked a gov't salvage project?
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #7 (permalink)  
Old 08-15-07, 11:09
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
It's called a straight VSAM Conversion to a table format
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #8 (permalink)  
Old 08-15-07, 11:35
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Quote:
Originally Posted by r937
denormalize 90 tables into a couple??

i would like to see you try that
I bet Mike could work up an EAV layout that would do this.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #9 (permalink)  
Old 08-15-07, 15:27
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
EAV.. Oh God.....

I figured this would have been a good post for Mike_Bike_Kite to chew on.
Reply With Quote
  #10 (permalink)  
Old 08-15-07, 15:41
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Franky baby (somebody better get that reference, or I just look... odd!), good for you for not cutting corners and doing the things the way they really should be

SQL is no easy thing to learn, but by god, when you're working with normalized data it is far less of a headache!
__________________
George
Twitter | Blog
Reply With Quote
  #11 (permalink)  
Old 08-15-07, 16:06
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
No .... just ..... can't ........ stop ............. myself ........

EAV was a discussion that's now over - I do see that it has a valid place but only for scenarios where there is a tonne of continual change, performance isn't your main criteria and you don't mind a few compromises. None of that applies here so even I wouldn't even consider it here.

90 tables suggests a fair size system which, if it's important to your company, may be worth hiring a database expert to have a quick look over your design to highlight any possible issues. I'm sure you've done a fine job but you describe yourself as a novice and most novices start with small systems and work their way up rather than the other way round

3NF is always the first place to aim for in your database design but I think that good database designers should also try to think about how the developers will eventually access the data - if it's difficult to understand then it's likely to be used wrong, and even a perfect relational design that's difficult to use will earn itself a bad name.

We've had some rather trivial problems to solve recently so why not describe the situation (in the db concepts forum) and see what's suggested - at best you might get a few good ideas - at worst we all have a laugh

Mike
Reply With Quote
  #12 (permalink)  
Old 08-15-07, 16:06
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Quote:
Originally Posted by georgev
Franky baby (somebody better get that reference, or I just look... odd!), good for you for not cutting corners and doing the things the way they really should be

SQL is no easy thing to learn, but by god, when you're working with normalized data it is far less of a headache!
Hey Georgie... Your right. I am seeing how easy it is to change minor things as I need to in the data model. It sure doesn't make my life easy while making the front end though. *There* is where the developer has it rough. The more joins, the more complex it becomes for the developer. But its ok, I like the experience.

I didn't want t cut any corners on the data design. I can't imagine what a terrifying thing it would be or even the level of complexity that is involved in finding a data anomaly.

A while back I purchased a php classifieds website that used mysql. The db had about 70 tables but was not at all normalized. After about 1000 ads were placed on the board, one of the sellers called me and wanted to know what happened to a couple of his ads. They were gone.. I have no idea where they went and they was nothing in the transaction log either.

Look at the DDL form just one of the tables:

Quote:
CREATE TABLE `classifieds` (
`id` int(14) NOT NULL auto_increment,
`seller` int(13) default NULL,
`stockno` varchar(10) default NULL,
`live` tinyint(4) NOT NULL default '0',
`title` tinytext,
`date` int(14) default NULL,
`description` text,
`precurrency` varchar(25) NOT NULL default '',
`price` varchar(50) NOT NULL,
`postcurrency` varchar(25) NOT NULL default '',
`image` tinyint(4) default '0',
`category` int(11) default NULL,
`duration` int(11) default NULL,
`location_state` tinytext,
`location_country` tinytext NOT NULL,
`location_zip` varchar(10) default NULL,
`ends` int(14) default NULL,
`search_text` mediumtext NOT NULL,
`viewed` int(11) NOT NULL default '0',
`transaction_type` tinyint(4) NOT NULL default '0',
`cc_transaction_type` tinyint(4) NOT NULL default '0',
`bolding` tinyint(4) NOT NULL default '0',
`better_placement` tinyint(4) NOT NULL default '0',
`featured_ad` tinyint(4) NOT NULL default '0',
`subtotal` double(5,2) NOT NULL default '0.00',
`tax` double(5,2) NOT NULL default '0.00',
`total` double(5,2) NOT NULL default '0.00',
`customer_approved` tinyint(4) NOT NULL default '0',
`expiration_notice` int(11) NOT NULL default '0',
`email` tinytext NOT NULL,
`pedigree_s` tinytext NOT NULL,
`pedigree_ss` tinytext NOT NULL,
`pedigree_sd` tinytext NOT NULL,
`pedigree_sss` tinytext NOT NULL,
`pedigree_ssd` tinytext NOT NULL,
`pedigree_sds` tinytext NOT NULL,
`pedigree_sdd` tinytext NOT NULL,
`pedigree_d` tinytext NOT NULL,
`pedigree_ds` tinytext NOT NULL,
`pedigree_dd` tinytext NOT NULL,
`pedigree_dss` tinytext NOT NULL,
`pedigree_dsd` tinytext NOT NULL,
`pedigree_dds` tinytext NOT NULL,
`pedigree_ddd` tinytext NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1868 DEFAULT CHARSET=latin1;
How does one go about troubleshooting something like that? I was always curious about that.
Reply With Quote
  #13 (permalink)  
Old 08-15-07, 16:20
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Quote:
Originally Posted by mike_bike_kite
No .... just ..... can't ........ stop ............. myself ........

EAV was a discussion that's now over - I do see that it has a valid place but only for scenarios where there is a tonne of continual change, performance isn't your main criteria and you don't mind a few compromises. None of that applies here so even I wouldn't even consider it here.
Hi Mike. I'm glad to see that you have come a long way from your EAV post. I just wrote you off from that point but it looks like you have made progress in your understanding of how important normalization is.

I personally would trade performance any day of the week for a database that *I know* beyond a shadow of a doubt is going to give me correct information when I need it. I just couldn't see doing it any other way, really. You have slow performance, go gat a faster server.

Quote:
90 tables suggests a fair size system which, if it's important to your company, may be worth hiring a database expert to have a quick look over your design to highlight any possible issues. I'm sure you've done a fine job but you describe yourself as a novice and most novices start with small systems and work their way up rather than the other way round
This is actualy good advice Mike, thanks. I think I will ask Rudy or Blindman for their advice.

Quote:
3NF is always the first place to aim for in your database design but I think that good database designers should also try to think about how the developers will eventually access the data - if it's difficult to understand then it's likely to be used wrong, and even a perfect relational design that's difficult to use will earn itself a bad name.
That seems fair.. In this case, it seem to me that the database designer and the developer need to work hand in hand to iron out any questions or concerns so they can stay on the same page.

Quote:
We've had some rather trivial problems to solve recently so why not describe the situation (in the db concepts forum) and see what's suggested - at best you might get a few good ideas - at worst we all have a laugh
I have posted numerous times in that forum before and received some really sound advice that I have used in this model. I'm sure that my model is not perfect but I do believe that my data will not suffer from any serious data anomalies. Especially with the front end.

Last edited by Frunkie; 08-15-07 at 16:24.
Reply With Quote
  #14 (permalink)  
Old 08-15-07, 16:47
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Stop. Mike, you had me at
Quote:
Originally Posted by mike_bike_kite
3NF is always the first place to aim for in your database design but I think that good database...
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #15 (permalink)  
Old 08-15-07, 17:09
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
If you\ there is another decent SQL developer get the FE developers requirements and produce views to flatten out the structure for them. Don't get tempted into producing a few uber-views - a fair few tight tight, specific ones should help them out. Better still implement a database API via stored procedures. Get the business requirements from the developers and produce sprocs to meet their requirements. That way you concentrate on efficient SQL code and they concentrate on the other two tiers.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On