Editorials

Database Anti-Patterns

Recently I encountered a database design intended to reduce the load on a relational database that actually had the reverse impact. The problem was a parent child relationship having a 1 to 1 or many relationship.

Normally you would use two tables. You would have a parent table and a child table, containing a foreign key to the parent table.

I have observed, and recently been reminded, of a design where the parent table has columns for a single attribute instance. If there is only one instance, the parent contains the data. In those instances where there is more than one child value, then the child table is populated.

This is another relational anti-pattern that results in all kinds of inefficiency. When you have two different queries needed to obtain the data you introduce more work, confusion and probably corrupted data. Moreover, databases are tuned to perform join operations faster than just about anything.

Share anti-patterns you have encountered by adding to the conversation here, or by email to btaylor@sswug.org.

Cheers,

Ben