NYCPHP Meetup

NYPHP.org

[nycphp-talk] The user table

D. J. Waletzky dj at waletzky.com
Fri Mar 4 15:07:13 EST 2011


The problem with eliminating "redundant" info in a user table is that it
may not scale terribly well. I always take care to give any user table
an auto_incremented row number/uid, because the user's handle and
e-mail, though unique, may change. Without an independent index
changing either of these columns in the user table will cause all kinds
of headaches in other linked tables. With a row number you can save
space and CPU cycles by using numeric IDs for foreign keys.

You also have to look at the number of tables you want to have; for a
small user base, it may make more sense to keep the number of discrete
tales to a minimum and retain more info in a smaller number of tables
(say, one of them). 

I'd say that unless you have more than 4000 users (depending on the
limits of your db host) you can probably get away with keeping the
number of tables small and the numbers of columns somewhat high. It's
always best to run some sample queries to get a sense of how long they
might take.

Just my two cents!

--
D. J. Waletzky
dj at waletzky.com
646.209.0004
http://dj.waletzky.com/
"Non sunt multiplicanda entia praeter necessitam."



On Fri, 2011-03-04 at 14:41 -0500, Rob Marscher wrote:
> Some nice thoughts.  Thanks for sharing.
> 
> On Mar 4, 2011, at 2:30 PM, Gary Mort wrote:
> > Get rid of 2 of them.  And the one that makes the most sense to keep is username.
> 
> There's probably some sites where people don't even want to bother creating a username and just use an email address.  But then again... if you're using something like Facebook login and don't want to ask for extra permissions, then you don't have an email and then what...
> 
> So maybe it's good to take the email address and auto-generate a username from it just like you could take the person's first name and last name from Facebook and create a username from that -- even if your site doesn't actually display the username anywhere to the person on the site.
> 
> 
> _______________________________________________
> New York PHP Users Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> http://www.nyphp.org/Show-Participation





More information about the talk mailing list