I'd appreciate some opinions on a concern I have.
I have a [User] table in my database, with the basic stuff you'd expect, like username, password, etc...
This application requires that I track a vast number of attributes for each user. So much so, that I will likely run out of columns (row storage space).
I'm tempted to add a UserProperties table with UserID, PropertyKey and PropertyValue columns. This approach fits well with the requirements.
My concern is that if each user has say 100 properties, when the database has a million users in it, we'll have 100,000,000 property rows.
I would think that with a clustered index on the UserID, that access will still be screaming fast, and you are really storing about the same amount of data as you would with the mega-columns approach.
Any ideas or thoughts on performance concerns? Ideas for a better DB design?
Thanks!
UPDATE:
First, thanks so much for all the great responses!
I have been toying around with the possibilities, and one thing keeps bothering me. I need to query on some of these attributes pretty frequently, and worse yet, these queries could involve finding all users who match criteria on as many as 10 of these attributes at the same time.
As a result, I am now leaning towards the mega-column approach, but possibly splitting the data off into one (or more) separate tables, forming a one-to-one relationship keyed on the UserID.
I'm using LinqToSql, and while I think tables with this many columns are inelegant, I think considering all the challenges and trade-offs, it is probably the right one, but I am still eager to hear other opinions.