473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Table schema for user login system?

I'm in the process of refactoring the php code base I've amassed over
the last few years into an object-oriented framework. I'm about to
start in on the authentication/login extension and I've been thinking
about different approaches to the mysql table schema that stores basic
user login information. At present, user authentication is keyed to a
table with the following columns:

TABLE: basic_user
uid - int [primary]
handle - varchar [unique]*
email - varchar [unique]
password - varchar
access_lvl - tinyint
acct_status - tinyint
confirm_key - varchar
confirmed_timestamp - int
created_timestamp - int

* handle (user name) is optional -- email address alternatively can be
used as the handle

My strategy is to keep this table as minimal as possible and define it
as a kind of constant or standard for the framework. Then, other
tables can be created on a project-by-project basis to link to this
table and expand a user's information, if necessary. (Two examples
would be a profile table for expanding user profile info and an
activity log table to track user activity.)

I was interested in hearing some of the views of others who have
tackled this issue and how you've addressed it. Are there other
columns you like to include in your basic user table? What's your
table schema like?

Tom

Sep 28 '07 #1
22 17857
"klenwell" <kl******@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
I'm in the process of refactoring the php code base I've amassed over
the last few years into an object-oriented framework. I'm about to
start in on the authentication/login extension and I've been thinking
about different approaches to the mysql table schema that stores basic
user login information. At present, user authentication is keyed to a
table with the following columns:

TABLE: basic_user
uid - int [primary]
handle - varchar [unique]*
email - varchar [unique]
password - varchar
access_lvl - tinyint
acct_status - tinyint
confirm_key - varchar
confirmed_timestamp - int
created_timestamp - int

* handle (user name) is optional -- email address alternatively can be
used as the handle

My strategy is to keep this table as minimal as possible and define it
as a kind of constant or standard for the framework. Then, other
tables can be created on a project-by-project basis to link to this
table and expand a user's information, if necessary. (Two examples
would be a profile table for expanding user profile info and an
activity log table to track user activity.)

I was interested in hearing some of the views of others who have
tackled this issue and how you've addressed it. Are there other
columns you like to include in your basic user table? What's your
table schema like?
I went up and down that development path for years before I realized that,
as you mentioned, the login accounts table should be minimal... more minimal
than you described, certainly.

I try not to make it any bigger than userid and password - putting all that
other stuff into linked tables.
That way, later, if you cange the other stuff, you don't have to mess with
the actual login table.
Sep 29 '07 #2
On Sep 28, 9:42 pm, klenwell <klenw...@gmail.comwrote:
On Sep 28, 5:39 pm, "Sanders Kaufman" <bu...@kaufman.netwrote:
"klenwell" <klenw...@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...

I went up and down that development path for years before I realized that
...
`user_editcount` int(11) default NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name` (`user_name`),
KEY `user_email_token` (`user_email_token`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Tom
This is actually very interesting. I have been studying user systems a
lot over the last year or so and have never seen minimal tables in any
of the active/popular applications. Even the PHPBB3 is a huge offender
to your suggestion with their whopping 72 fields in their user table.
I have never really had any issues with dealing with tables with a
large number of entries, assuming they arent replicated or whatever.
In fact, i have only ever read about/seen/been forced to use linked
tables when data is replicated.

Can you provide any reasoning for your minimal approach?

Sep 29 '07 #3
This is actually very interesting. I have been studying user systems a
lot over the last year or so and have never seen minimal tables in any
of the active/popular applications. Even the PHPBB3 is a huge offender
to your suggestion with their whopping 72 fields in their user table.
I have never really had any issues with dealing with tables with a
large number of entries, assuming they arent replicated or whatever.
In fact, i have only ever read about/seen/been forced to use linked
tables when data is replicated.

Can you provide any reasoning for your minimal approach?
Login tables tend to store a lot of things that just do not belong
there. An account is just an account. It is not a user, and it is not an
activation. These things are usually separate, or should be. I have had
to cope with too many systems that abused a user table as an account
table. This may sound nice, until you find out that:
- There can be more types of account per user (say, a web account and an
office account. Activations are totally different for "near" or remote
accounts)
- Not every user has these account
- Some accounts may link to more than one table that could be seen as a
user table: A web site may know users and suppliers. At some point,
somebody requires that the suppliers can log in as well. I leave the
rest up to your imagination.

All the above examples are real and I have had to deal with them in the
past months.
Sep 29 '07 #4
Dikkie Dik wrote:
>This is actually very interesting. I have been studying user systems a
lot over the last year or so and have never seen minimal tables in any
of the active/popular applications. Even the PHPBB3 is a huge offender
to your suggestion with their whopping 72 fields in their user table.
I have never really had any issues with dealing with tables with a
large number of entries, assuming they arent replicated or whatever.
In fact, i have only ever read about/seen/been forced to use linked
tables when data is replicated.

Can you provide any reasoning for your minimal approach?

Login tables tend to store a lot of things that just do not belong
there. An account is just an account. It is not a user, and it is not an
activation. These things are usually separate, or should be. I have had
to cope with too many systems that abused a user table as an account
table. This may sound nice, until you find out that:
It depends on how you define "account" and "user". In many systems,
each account is considered a different user.

Also, whether the account is activated or not is an attribute to that
account.
- There can be more types of account per user (say, a web account and an
office account. Activations are totally different for "near" or remote
accounts)
- Not every user has these account
- Some accounts may link to more than one table that could be seen as a
user table: A web site may know users and suppliers. At some point,
somebody requires that the suppliers can log in as well. I leave the
rest up to your imagination.
Sure. But a proper database design and you don't have these problems.
All the above examples are real and I have had to deal with them in the
past months.
Only the past months? They've been going on for the 20 years I've
been involved in RDB design/development. And they aren't going to go away.

But many of these problems also occur because the system needs changed
over the years. Things were correct when they were first laid out, but
as things changed, management tried to modify existing code to "make it
fit", rather than take a look at redesigning the system to make it work.

Such decisions are almost always cheap in the short term, but expensive
in the long term.

The answer is proper system design - including the database. And you
can't make one rule which covers all solutions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 29 '07 #5
I, for my framework, put:

ID
USERNAME
PASSWORD
EMAIL

That is for the simple login / logout / register data.
Then, according to the application, there is another user table, which
holds all the user's information. It is always made from scratch as I
never know which fields my customer requires or my code needs ;). For
example, for a social networking site you need about me, musical
interests, ..., but for a customer account on a shop, you needn't such
things. The main users table only stores what is essential in ALL
users. Then I make a relation between them, connecting users by ID.
The record with ID X on main table belongs to ID X on the other table.

By the way, PHPBB3, MediaWiki and such are not frameworks, they are
not made to be as broad as possible. They are ONLY made for themselves
and their specific needs, while a framework needs us to remember that
it has to work with all websites from top to bottom.

---
Bruno Rafael Moreira de Barros

Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6

:: Looking For A Permanent Job ::
---

Sep 29 '07 #6
On Sep 29, 6:57 am, Bruno Barros <rage...@gmail.comwrote:
I, for my framework, put:

ID
USERNAME
PASSWORD
EMAIL

That is for the simple login / logout / register data.
Then, according to the application, there is another user table, which
holds all the user's information. It is always made from scratch as I
never know which fields my customer requires or my code needs ;). For
example, for a social networking site you need about me, musical
interests, ..., but for a customer account on a shop, you needn't such
things. The main users table only stores what is essential in ALL
users. Then I make a relation between them, connecting users by ID.
The record with ID X on main table belongs to ID X on the other table.

By the way, PHPBB3, MediaWiki and such are not frameworks, they are
not made to be as broad as possible. They are ONLY made for themselves
and their specific needs, while a framework needs us to remember that
it has to work with all websites from top to bottom.

---
Bruno Rafael Moreira de Barros

Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6

:: Looking For A Permanent Job ::
---
I wasnt really worried about frameworks, but i dont know of any
framework that has details directing the developers to keep the user
tables small. That aside, is the summation of the above to do what
your application needs? I can understand the situation where your user
has multiple accounts, but i dont think that really has much bearing
on most web applications; as Jerry brought up -
It depends on how you define "account" and "user". In many
systems, each account is considered a different user.
Ive
actually found that most applications do treat "accounts" and "users"
as one mass, and especially so in my discussions with a few folks on
the oncoming wave of Open ID compliant applications. Are there any
rules of thumb that have come up? this is of course aside from "if it
occurs more than once you should probably be using another table."

Sep 29 '07 #7
Bruno Barros wrote:
I, for my framework, put:

ID
USERNAME
PASSWORD
EMAIL

That is for the simple login / logout / register data.
Then, according to the application, there is another user table, which
holds all the user's information. It is always made from scratch as I
never know which fields my customer requires or my code needs ;). For
example, for a social networking site you need about me, musical
interests, ..., but for a customer account on a shop, you needn't such
things. The main users table only stores what is essential in ALL
users. Then I make a relation between them, connecting users by ID.
The record with ID X on main table belongs to ID X on the other table.

By the way, PHPBB3, MediaWiki and such are not frameworks, they are
not made to be as broad as possible. They are ONLY made for themselves
and their specific needs, while a framework needs us to remember that
it has to work with all websites from top to bottom.

---
Bruno Rafael Moreira de Barros

Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6

:: Looking For A Permanent Job ::
---
That's one way to do it. But it's not necessarily a good database
design. If there is information specific to that user, I include it in
the same table. Among other things, it saves unnecessary joins.

But this doesn't belong in a PHP newsgroup, anyway. It's more
applicable to a database newsgroup.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 29 '07 #8
<bo*********@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
This is actually very interesting. I have been studying user systems a
lot over the last year or so and have never seen minimal tables in any
of the active/popular applications.
of the active/popular applications. Even the PHPBB3 is a huge offender
to your suggestion with their whopping 72 fields in their user table.
I have never really had any issues with dealing with tables with a
large number of entries, assuming they arent replicated or whatever.
In fact, i have only ever read about/seen/been forced to use linked
tables when data is replicated.

Can you provide any reasoning for your minimal approach?

It's a DB theory purist thing - with very few real-world applications.
In fact - I don't think I've *ever* encountered a fully normalized database
in the real world.
But that doesn't stop me from evangelizing normalized data!

Non-normalized data is to Databases what spaghetti code is to language.
It may work fine for the folks who threw the app together, but they're the
ONLY ones who will enjoy it.

The benefits of fully normalized data are most readily apparent
- in massive databases
- or after years of use,
- or in systems that later try to integrate with other systems.

Sep 29 '07 #9

"Bruno Barros" <ra*****@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
I, for my framework, put:

ID
USERNAME
PASSWORD
EMAIL

That is for the simple login / logout / register data.
Then, according to the application, there is another user table, which
holds all the user's information. It is always made from scratch as I
never know which fields my customer requires or my code needs ;). For
example, for a social networking site you need about me, musical
interests, ..., but for a customer account on a shop, you needn't such
things. The main users table only stores what is essential in ALL
users. Then I make a relation between them, connecting users by ID.
The record with ID X on main table belongs to ID X on the other table.

By the way, PHPBB3, MediaWiki and such are not frameworks, they are
not made to be as broad as possible. They are ONLY made for themselves
and their specific needs, while a framework needs us to remember that
it has to work with all websites from top to bottom.
I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.

But I also want fields for login_cookie, last_login, and parent_user.
I don't really WANT to create whole nother table to track that stuff, but
good design dictates that I should.

The question becomes - if I break atomicity for expedience's sake, what will
be the consequences?

Sep 29 '07 #10
..oO(Sanders Kaufman)
><bo*********@gmail.comwrote in message
news:11**********************@k79g2000hse.googleg roups.com...
>Can you provide any reasoning for your minimal approach?

It's a DB theory purist thing - with very few real-world applications.
In fact - I don't think I've *ever* encountered a fully normalized database
in the real world.
A fully normalized database wouldn't make much sense at all or would
cause way too much overhead. Sometimes even a little redundancy can be
much more practical in the real application.

The question is also how you define "fully normalized". Where do you
draw the line? 3NF? BCNF? While the first 3 normal forms more or less
only reduce redundancy, the more higher normal forms may also destroy
dependencies.
>But that doesn't stop me from evangelizing normalized data!
Where's the point in storing the user's email address in another table
instead of the user or account table itself? It only makes sense if
there can be multiple addresses.
>Non-normalized data is to Databases what spaghetti code is to language.
Over-normalized data is to databases what div-soup is to HTML.

Micha
Sep 29 '07 #11
..oO(Dikkie Dik)
>Login tables tend to store a lot of things that just do not belong
there. An account is just an account. It is not a user, and it is not an
activation.
In my system one account = one user. The accounts table keeps user
names, login names, password hashes, account creation and expiration
dates, date of last login, privilege and status flags and such things.

Additional user data like special profiles, addresses, contacts etc. are
stored in other tables.
>- There can be more types of account per user (say, a web account and an
office account. Activations are totally different for "near" or remote
accounts)
I can apply different roles (user groups) to each account.

Micha
Sep 29 '07 #12
Sanders Kaufman wrote:
"Bruno Barros" <ra*****@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
>I, for my framework, put:

ID
USERNAME
PASSWORD
EMAIL

That is for the simple login / logout / register data.
Then, according to the application, there is another user table, which
holds all the user's information. It is always made from scratch as I
never know which fields my customer requires or my code needs ;). For
example, for a social networking site you need about me, musical
interests, ..., but for a customer account on a shop, you needn't such
things. The main users table only stores what is essential in ALL
users. Then I make a relation between them, connecting users by ID.
The record with ID X on main table belongs to ID X on the other table.

By the way, PHPBB3, MediaWiki and such are not frameworks, they are
not made to be as broad as possible. They are ONLY made for themselves
and their specific needs, while a framework needs us to remember that
it has to work with all websites from top to bottom.

I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.

But I also want fields for login_cookie, last_login, and parent_user.
I don't really WANT to create whole nother table to track that stuff, but
good design dictates that I should.
And what "good design" is that? Definitely not normalization.
The question becomes - if I break atomicity for expedience's sake, what will
be the consequences?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 29 '07 #13
That's one way to do it. But it's not necessarily a good database
design. If there is information specific to that user, I include it in
the same table. Among other things, it saves unnecessary joins.
No need to join, just fetch both tables and process the results. Then,

$who_is_logged_in == 1; // Just an example saying the user that is
logged has an ID of 1.
$user_who_is_logged_in_data ==
$data_from_second_table[$who_is_logged_in];

I prefer to do this way. And what I meant was not to do using two
tables, but that it would be more profitable on an abstraction basis,
as you would never have to deal with the first table, which was
absolutely important. Of course you don't need to use my method,
afterall, it's my framework ;).
But this doesn't belong in a PHP newsgroup, anyway. It's more
applicable to a database newsgroup.
Doubt it. All they could do was tell you the best way to link the
tables and do all that DB stuff. What we PHPers want is the best
minimal way to get a working user system.

---
Bruno Rafael Moreira de Barros

Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6

:: Looking For A Permanent Job ::
---

Sep 29 '07 #14
On Sep 29, 1:48 pm, Bruno Barros <rage...@gmail.comwrote:
That's one way to do it. But it's not necessarily a good database
design. If there is information specific to that user, I include it in
the same table. Among other things, it saves unnecessary joins.

No need to join, just fetch both tables and process the results. Then,

$who_is_logged_in == 1; // Just an example saying the user that is
logged has an ID of 1.
$user_who_is_logged_in_data ==
$data_from_second_table[$who_is_logged_in];

I prefer to do this way. And what I meant was not to do using two
tables, but that it would be more profitable on an abstraction basis,
as you would never have to deal with the first table, which was
absolutely important. Of course you don't need to use my method,
afterall, it's my framework ;).
But this doesn't belong in a PHP newsgroup, anyway. It's more
applicable to a database newsgroup.

Doubt it. All they could do was tell you the best way to link the
tables and do all that DB stuff. What we PHPers want is the best
minimal way to get a working user system.

---
Bruno Rafael Moreira de Barros

Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6

:: Looking For A Permanent Job ::
---
Doesnt fetching both tables kill the logic that is provided in keeping
your data separate? when i first started studying application design
my teacher sat down and explained that if there is a way to simplify
your application you should do it, and i see what you have said here
to be kind of difficult to parse.

Why would you not take advantage of something the database provides,
even if you are able to handle processing in your application, since
you would be using a smaller data set and most likely focusing on the
data that is actually being used on that page? I would be really weary
of an application that just grabbed everything from the database and
processed it in its own code when it didnt need to. Ive seen it a
couple times and as time goes on, as has been brought up above, your
application will lose its responsiveness and eventually become
useless.

im glad that we have brought things back to the PHP end of things, but
i dont want to come off half cocked. I am certain that application
design is much more than the language you choose to build it in, and
if you are going to say that grabbing all your information at once and
processing it in your framework is your choice means of doing things,
but i would really like to see the benchmarks that would support that
means of development. I am fairly sure that your framework is playing
with fire, and i fear for anyone who chooses to follow that pattern of
development.

SQL is an extensive language so you don't have to bother dealing with
most processing issues, such as the one you have shown here.

Sep 30 '07 #15
On 30 Sep, 09:12, "bob.chat...@gmail.com" <bob.chat...@gmail.com>
wrote:
On Sep 29, 1:48 pm, Bruno Barros <rage...@gmail.comwrote:
That's one way to do it. But it's not necessarily a good database
design. If there is information specific to that user, I include it in
the same table. Among other things, it saves unnecessary joins.
No need to join, just fetch both tables and process the results. Then,
$who_is_logged_in == 1; // Just an example saying the user that is
logged has an ID of 1.
$user_who_is_logged_in_data ==
$data_from_second_table[$who_is_logged_in];
I prefer to do this way. And what I meant was not to do using two
tables, but that it would be more profitable on an abstraction basis,
as you would never have to deal with the first table, which was
absolutely important. Of course you don't need to use my method,
afterall, it's my framework ;).
But this doesn't belong in a PHP newsgroup, anyway. It's more
applicable to a database newsgroup.
Doubt it. All they could do was tell you the best way to link the
tables and do all that DB stuff. What we PHPers want is the best
minimal way to get a working user system.
---
Bruno Rafael Moreira de Barros
Adobe Photoshop CS2 and CS3
-
XML / XSLT
-
MySQL / SQLite / TerraDB
-
PHP 3, 4, 5 and 6
:: Looking For A Permanent Job ::
---

Doesnt fetching both tables kill the logic that is provided in keeping
your data separate? when i first started studying application design
my teacher sat down and explained that if there is a way to simplify
your application you should do it, and i see what you have said here
to be kind of difficult to parse.

Why would you not take advantage of something the database provides,
even if you are able to handle processing in your application, since
you would be using a smaller data set and most likely focusing on the
data that is actually being used on that page? I would be really weary
of an application that just grabbed everything from the database and
processed it in its own code when it didnt need to. Ive seen it a
couple times and as time goes on, as has been brought up above, your
application will lose its responsiveness and eventually become
useless.

im glad that we have brought things back to the PHP end of things, but
i dont want to come off half cocked. I am certain that application
design is much more than the language you choose to build it in, and
if you are going to say that grabbing all your information at once and
processing it in your framework is your choice means of doing things,
but i would really like to see the benchmarks that would support that
means of development. I am fairly sure that your framework is playing
with fire, and i fear for anyone who chooses to follow that pattern of
development.

SQL is an extensive language so you don't have to bother dealing with
most processing issues, such as the one you have shown here.
Yes I know, but I just spoken about that for the way of separating
things (the user login and the user data). Of course it can be done, I
just explained the PHP way of doing it.

Sep 30 '07 #16
Ouch - deleting an account is a bad way to disable a login.
Better to reduce the privledges for the account.
If you have a privileges system. Else, you should just have a BANNED
field that's a boolean :).

Sep 30 '07 #17
On Sep 30, 5:45 am, "Sanders Kaufman" <bu...@kaufman.netwrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message

news:We******************************@comcast.com. ..
Sanders Kaufman wrote:
I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.
But I also want fields for login_cookie, last_login, and parent_user.
I don't really WANT to create whole nother table to track that stuff, but
good design dictates that I should.
And what "good design" is that? Definitely not normalization.

Definitely normalization.
The question becomes - if I break atomicity for expedience's sake, what
will be the consequences?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Has anyone got any benchmarks or profiling data to back up their
claims? i have never noticed any performance increases based on
setting up a database to be set up in the, for lack of a better label,
"Everything belonging to the user in the user table" form versus the
"Spread it out and call it normalized" form. There is of course merit
to both options, but i think that it would be better to stop
speculating and start supporting the information.

I am working on a paper on this stuff so if i try to back something up
with "Sanders Kaufman" or "Bruno Barros" said it wont come across very
well.

Sep 30 '07 #18
bo*********@gmail.com wrote:
On Sep 30, 5:45 am, "Sanders Kaufman" <bu...@kaufman.netwrote:
>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message

news:We******************************@comcast.com ...
>>Sanders Kaufman wrote:
I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.
But I also want fields for login_cookie, last_login, and parent_user.
I don't really WANT to create whole nother table to track that stuff, but
good design dictates that I should.
And what "good design" is that? Definitely not normalization.
Definitely normalization.
>>>The question becomes - if I break atomicity for expedience's sake, what
will be the consequences?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Has anyone got any benchmarks or profiling data to back up their
claims? i have never noticed any performance increases based on
setting up a database to be set up in the, for lack of a better label,
"Everything belonging to the user in the user table" form versus the
"Spread it out and call it normalized" form. There is of course merit
to both options, but i think that it would be better to stop
speculating and start supporting the information.

I am working on a paper on this stuff so if i try to back something up
with "Sanders Kaufman" or "Bruno Barros" said it wont come across very
well.
I could comment in more detail on this, with a lot of examples.
However, this is not the correct newsgroup for discussion database
design. I would be interested in discussing it more in an appropriate
newsgroup, such as comp.databases.mysql.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 30 '07 #19
On 30 Sep, 19:09, "bob.chat...@gmail.com" <bob.chat...@gmail.com>
wrote:
On Sep 30, 5:45 am, "Sanders Kaufman" <bu...@kaufman.netwrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:We******************************@comcast.com. ..
Sanders Kaufman wrote:
>I'm woring on a similar situation.
>I've got a userid, username, emailaddress and password.
>But I also want fields for login_cookie, last_login, and parent_user.
>I don't really WANT to create whole nother table to track that stuff, but
>good design dictates that I should.
And what "good design" is that? Definitely not normalization.
Definitely normalization.
>The question becomes - if I break atomicity for expedience's sake, what
>will be the consequences?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Has anyone got any benchmarks or profiling data to back up their
claims? i have never noticed any performance increases based on
setting up a database to be set up in the, for lack of a better label,
"Everything belonging to the user in the user table" form versus the
"Spread it out and call it normalized" form. There is of course merit
to both options, but i think that it would be better to stop
speculating and start supporting the information.

I am working on a paper on this stuff so if i try to back something up
with "Sanders Kaufman" or "Bruno Barros" said it wont come across very
well.
I never said there would be performance differences, nor I named it
normalization. I named it keep the essential table a MUST for ALL
applications using the framework and then, according to the
applications' needs, use another table with the data needed. Not all
applications need the same amount of information! For example, a
customer needs to give away his phone number to be contacted, but a
guy registering for a forum doesn't have to! And then, instead having
a big fat table with a load of fields that might or might not be used
for the applications, you only had what was really necessary!

Oct 1 '07 #20
Bruno Barros wrote:
On 30 Sep, 19:09, "bob.chat...@gmail.com" <bob.chat...@gmail.com>
wrote:
>On Sep 30, 5:45 am, "Sanders Kaufman" <bu...@kaufman.netwrote:
>>"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
news:We******************************@comcast.co m...
Sanders Kaufman wrote:
I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.
But I also want fields for login_cookie, last_login, and parent_user.
I don't really WANT to create whole nother table to track that stuff, but
good design dictates that I should.
And what "good design" is that? Definitely not normalization.
Definitely normalization.
The question becomes - if I break atomicity for expedience's sake, what
will be the consequences?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Has anyone got any benchmarks or profiling data to back up their
claims? i have never noticed any performance increases based on
setting up a database to be set up in the, for lack of a better label,
"Everything belonging to the user in the user table" form versus the
"Spread it out and call it normalized" form. There is of course merit
to both options, but i think that it would be better to stop
speculating and start supporting the information.

I am working on a paper on this stuff so if i try to back something up
with "Sanders Kaufman" or "Bruno Barros" said it wont come across very
well.

I never said there would be performance differences, nor I named it
normalization. I named it keep the essential table a MUST for ALL
applications using the framework and then, according to the
applications' needs, use another table with the data needed. Not all
applications need the same amount of information! For example, a
customer needs to give away his phone number to be contacted, but a
guy registering for a forum doesn't have to! And then, instead having
a big fat table with a load of fields that might or might not be used
for the applications, you only had what was really necessary!
But I called it what it is - an example of overnormalization which
causes more performance problems. And stupid.

But again, this a PHP group, not a database group. If you want to
continue this inane discourse, please take it to a database newsgroup -
where you will be told why you're wrong by a lot of database experts.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 1 '07 #21
On Mon, 01 Oct 2007 11:16:17 +0200, Bruno Barros <ra*****@gmail.comwrote:
On 30 Sep, 19:09, "bob.chat...@gmail.com" <bob.chat...@gmail.com>
wrote:
>On Sep 30, 5:45 am, "Sanders Kaufman" <bu...@kaufman.netwrote:
"Jerry Stuckle" <jstuck...@attglobal.netwrote in message
>news:We******************************@comcast.com ...
Sanders Kaufman wrote:
I'm woring on a similar situation.
I've got a userid, username, emailaddress and password.
>But I also want fields for login_cookie, last_login, and
parent_user.
>I don't really WANT to create whole nother table to track that
stuff, but
>good design dictates that I should.
And what "good design" is that? Definitely not normalization.
Definitely normalization.
>The question becomes - if I break atomicity for expedience's sake,
what
>will be the consequences?

Has anyone got any benchmarks or profiling data to back up their
claims? i have never noticed any performance increases based on
setting up a database to be set up in the, for lack of a better label,
"Everything belonging to the user in the user table" form versus the
"Spread it out and call it normalized" form. There is of course merit
to both options, but i think that it would be better to stop
speculating and start supporting the information.

I am working on a paper on this stuff so if i try to back something up
with "Sanders Kaufman" or "Bruno Barros" said it wont come across very
well.

I never said there would be performance differences, nor I named it
normalization. I named it keep the essential table a MUST for ALL
applications using the framework and then, according to the
applications' needs, use another table with the data needed. Not all
applications need the same amount of information! For example, a
customer needs to give away his phone number to be contacted, but a
guy registering for a forum doesn't have to! And then, instead having
a big fat table with a load of fields that might or might not be used
for the applications, you only had what was really necessary!
Who cares there's more information in the database? As long as you just
use 'SELECT only,the,fields,I,need FROM table' instead of a lazy 'SELECT *
FROM table', eveything's going to be speedy and allright. On a side note:
I know forums where a telephone number is needed/required/recommended.
Usually a more closed, select group forum though.
--
Rik Wasmus
Oct 1 '07 #22
..oO(Rik Wasmus)
>On Mon, 01 Oct 2007 11:16:17 +0200, Bruno Barros <ra*****@gmail.comwrote:
>>
I never said there would be performance differences, nor I named it
normalization. I named it keep the essential table a MUST for ALL
applications using the framework and then, according to the
applications' needs, use another table with the data needed. Not all
applications need the same amount of information! For example, a
customer needs to give away his phone number to be contacted, but a
guy registering for a forum doesn't have to! And then, instead having
a big fat table with a load of fields that might or might not be used
for the applications, you only had what was really necessary!

Who cares there's more information in the database?
I don't want to have 30 fields in a table, if only 5 of them are used in
most cases. In a shop database I surely don't want to have just a single
products table that holds all possible attributes and additional
informations for all the different products. It just keeps the main and
common stuff, while additional informations are stored in separate
tables as necessary (for example track infos for music CDs).
>As long as you just
use 'SELECT only,the,fields,I,need FROM table' instead of a lazy 'SELECT *
FROM table', eveything's going to be speedy and allright.
JOINs on properly indexed tables are fast as well.
>On a side note:
I know forums where a telephone number is needed/required/recommended.
Usually a more closed, select group forum though.
But there could also be a second phone number (private and business for
example), a fax, some mobile numbers, IM names ... clearly enough to use
another table for all the contact data.

Micha
Oct 1 '07 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ping | last post by:
I have sys to grant the following to a schema: (login as sys from sqlplus 8.1.6 on linux) grant select any table to a; grant execute on dbms_alert to a; grant create any procedure to a; ...
4
by: Wade Chy | last post by:
Hi All I am in a situation where I have to grant select privileges on tables owned by a different owner to a specific role. I am logged in as system/sysdba. I have created a new role...
36
by: toedipper | last post by:
Hello, I am designing a table of vehicle types, nothing special, just a list of unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor etc etc For the table design I am...
2
by: wooks | last post by:
<?xml version='1.0'?> <userlogin xmlns="urn:faster:userlogin" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <login>mick</login> <password>brown</password> </userlogin> Above is my...
0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
0
by: chobin | last post by:
Hi all. I've a terrible question. I've to build one XML page (based on a xml schema) that implements a dynamic database. In particular, I would declare something like this: <?xml version="1.0"...
5
by: dotyet | last post by:
I have been given the daunting task of sql query tuning. I am looking for ways to get started with that. I am on DB2 UDB 8.2 (8.1 with Fixpak 8) on Windows. One point which I could think about...
7
by: Serge Rielau | last post by:
Hi all, Following Ian's passionate postings on problems with ALTOBJ and the alter table wizard in the control center I'll try to explain how to use ALTOBJ with this thread. I'm not going to get...
0
by: mayurshah28 | last post by:
Hi everyone, im developing one application for banking. there i have stucked wit one prob. now prob is tat im not able to access multiple tables at a time through vb. my coding is as below Dim...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.