From The Mana World
Revision as of 15:57, 20 November 2005 by Verious (talk | contribs) (Database Schema Recommended Changes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I think it is generally a bad idea to use the player's username as the primary key that links together the tables for the following reasons:

  • Renaming the player will be unnecessarily difficult (since the username will have to be updated in almost every table) (yes, I realize you could setup a cascading update to update the username foreign key in every table; however, this is completely unnecessary and a waste of resources)
  • Data storage is massively redundant, which defeats the purpose of a relational database
  • The currently proposed schema will require 32 bytes of storage for every record in almost every table just for the primary key

A substantially better design would be a Users table which contains a Unique Identifier (auto-number, GUID, or other similar field type), this revised schema would only require between 4-16 bytes per record per table and allow the username to be updated in a single place.