Log in

No account? Create an account
entries friends calendar profile Previous Previous Next Next
Working on the SQL - shadows of echoes of memories of songs — LiveJournal
Working on the SQL
Read 13 | Write
mobbsy From: mobbsy Date: August 18th, 2008 07:55 pm (UTC) (Link)

The number one bad habit I have to train people working with me on this out of is that they are still being taught from textbooks which say "duplicating data BAD" and they want to make complex cross-queries and so forth, which, once your dataset reaches any reasonable size is a net loss. Almost all the time these days, disk space is less of an issue than speed of response; so build the tables that your ussers will query in order to make the questions they will ask simple queries. [ The more control you exercise over what your users can do, the better. Ideally one convinces them that this was their idea. ]

Gak! Normalised database design isn't about saving disk space, it's about data integrity. With data duplicated all across the schema, you're asking for inconsistency. If you need to denormalise for performance, do so in materialized views not in the basic schema.
From: (Anonymous) Date: August 18th, 2008 08:07 pm (UTC) (Link)
Yes! Please listen to Mobbsy here. Database schemas should represent the data and its existing relationships, not be built 'in order to make the questions they will ask simple queries'. You exercise control over users by building them applications (or at the very least procedures and views) so they don't query and manipulate tables directly.
Read 13 | Write