Re: Whats more efficient?
Date: 30 Mar 2001 09:23:37 -0600
Message-ID: <n0kae63b7ra.fsf_at_vendor17.austin.ibm.com>
In article <9a01h1$9l1$1_at_bob.news.rcn.net> "Tom" <Tom_at_webartisan.com> writes:
I am working on a database that is being used for user authentication on a web site. I'm trying to figure out the most efficient way to lay out the table(s). Here is how its currently arranged:
PERMISSIONS(UserId[pk], Area1, Area2, Area3, etc..)
There is a record for each user, each area is a boolean y/n data type. I dont really think this is the most efficient way, because there are alot of null values (not all users have access to all areas).
Because the relationship of users to areas is M:M, would it be more efficient to break the above into the following two tables?
AREA(AreaId, blah, blah, etc..)
PERMISSIONS(UserId, AreaId) <--Intersection Table
I'm new at this, so any help would be greatly appreciated.
Thanks,
Tom
While this would be a good place for multiple tables, you could also bit-map the permissions. Something like the file permissions in Unix. i.e.: Area1 = 1, Area2 = 2, Area3 = 4, Area4 = 8...... Access to Area1 & Area2 would be 3, access to Area2 & Area3 would be 6, and so on. This would be a "challenging" method, as you need to truely understand the bit-map, but it is efficient.
-- Micheal Mc Evoy mcevoym_at_us.ibm.com Tools Developer, RS/6000 Engineering Software, IBM Server Group Austin, TexasReceived on Fri Mar 30 2001 - 17:23:37 CEST