Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...DNNDNN's Database design and normalization
Previous
 
Next
New Post
2/20/2012 11:11 PM
 

Hi Nukers,

I've just been poking around the database behind DNN 6, and have noticed that some basic database design principles are missing, or poorly implemented.  Here's a few.

TabModuleSettings.SettingValue - A varchar column that can be used to store referential links back to the file system via an entry like "FileID=21323".   Seems to store all sorts of data here, including binary (true/false) values.  Using a text field to store different types of data is a really, really bad practice.  This is not good for referential integrity, indexing, searching or coding. 

Lots of column name in lots of tables end in "ID" - presumably to store a foreign key.  There is rarely a foreign key constraint on such columns.  This is a time-bomb waiting to happen.  This is the perfect way to create lots of orphaned records.  Also makes it hard to track down relational links between tables.  Link the tables up via a key and reap the benefits of tight data integrity, query speed (index both ends of the joins).

Lots of meta-data / entity-attribute-value style (EAV) tables.  These are not good design and terrible for performance.  These are common when computer programmers design databases.  The amount of linking and joins you have to do just to get data is going to slow things down.  you cannot enforce data integrity or referential integrity.  One of the worse sins in database design.

There are other issues also.

Just wondering, is there a dedicated team that look after the database and oversee module development in terms of good database practice?  I think this would be good for the future of DNN development.  Perhaps a checklist that each module's database design needs to pass - not just at the end of development, but during the design phase also - where database design needs to be done right.

Hope this helps.  I say this in the spirit of product feedback and development.  DNN is a great platform that really needs a rock-solid database platform in order to grow and scale.

Rod

 

 
New Post
2/21/2012 3:04 AM
 

Hello,

Regarding the sub-optimal database structure, in some cases this is because of legacy functions (and thus could be fixed), in other's it's deliberate (e.g. both tabs and users support "soft-deletes" so the removal of cascading deletes/foreign keys is deliberate to support that functionality). In addition some parts such as modulesettings/tabmodulesettings deliberately use "generic" columns to allow for extensible behaviour i.e. both support storing different types of settings so uses a simple structure that stores name/value pairs as otherwise modules/tabmodules would be limited to the set of fields we make available.

we don't have a dedicated database team (though we recently did contract someone to do database optimisations for us) but any issues you think should be addressed should be logged at support.dotnetnuke.com so we can investigate and respond. We tend to iteractively update the database (changing schema/column type) as and when we see the need and dependant on the version targetted e.g. we've been updating a number of nvarchax fields to nvarchar(max) to support longer page headings etc.


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/21/2012 3:27 AM
 
Hi Cathal, thanks for your response.

You can still have soft deletes with proper database referential integrity. You just need a "IsDeleted" bit field for each entity/table and switch it accordingly. It's a bit of additional work at the code level, but you won't run into all of the database orphans that DNN (or any database that doesn't have referential integrity constraints) will create. These will become a problem in the future - I 100% guarantee it. Also, you don't need to turn on the cascading delete option within the database - it's just there if you want the database to automatically do it. I think a lot of applications will handle the cascading "deletes" within code or similar.

The way I see it, application functionality should never compromise database integrity and best-practice design - the database has to be the last defense against bad data. Not implementing data integrity because of soft deletes is not right, and a lack of programmer knowledge.

Generic tables have their place, but generic database design will lead to generic performance, generic scalability and generic data integrity.

Also, please be wary of VarChar(MAX) columns. They have their place, but only use them if you need to. They dramatically affect indexing, page sizes, data storage and more. They should not be simply used as a replacement for varchar(x).

I hope one day DNN will have a dedicated database architect to advise, design and improve the overall performance of the database. A platform like DNN needs a solid platform under it.

Hope this helps.
Rod





 
New Post
2/21/2012 5:45 AM
 
actually just checked and we do have an isdeleted column on those tables (been a while since i looked at the schema and wasnt aware of that). I fully agree that ideally we would have a dedicateed DBA - hopefully as we make more sales we can increase the number of staff and look to hire one

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
2/27/2012 11:59 PM
 

Rod Weir wrote:
... Lots of meta-data / entity-attribute-value style (EAV) tables.  These are not good design and terrible for performance.  These are common when computer programmers design databases.  The amount of linking and joins you have to do just to get data is going to slow things down.  you cannot enforce data integrity or referential integrity.  One of the worse sins in database design.

I noticed that to when trying looking around in there.  I just cant wrap my head around it in the EVA style.  Why would a programmer want this? Seems way harder to grok.

..

 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...DNNDNN's Database design and normalization


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out