OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
User Preferences?

From: Waynn Lue (waynnluegmail.com)
Date: Thu Feb 28 2008 - 03:50:49 CST


I'm looking for a good way to store user preferences. The most
straightforward way is just to add a column to the Users table for
each preference we're looking to store. Downside is that it requires
an ALTER TABLE which gets prohibitively expensive as it gets larger,
as it's fairly inflexible. I've come up with a few alternatives, and
I'm wondering if people have ideas or suggestions, as this has to be a
common problem. A quick Google search didn't turn up anything.

1. Store the preferences as a binary blob on the Users table. This
blob could be either a blob, or an integer that I use application
logic to read/write from, or I could use the SET datatype.
2. Store the preferences in normalized form, with a new table called
UserPreferences that has UserId, Setting, Preference and we add a row
for each setting of that user.
3. Create a separate table each time we want to add a new setting,
UserId, WhateverTheNameOfThePreferenceIs.

Anyone have any experience with this, or better suggestions?

Thanks,
Waynn

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql