Suggested Database size?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Skoalbasher
Forum Contributor
Posts: 147
Joined: Thu Feb 07, 2008 8:09 pm

Suggested Database size?

Post by Skoalbasher »

Hi All, I usually look around here, hardly ever ask questions.

I'm working on a data base table for users.

Getting the standard information. Username, password, first name, last name, address, etc..
I'm using phpMyAdmin, and trying to determine how big I want each field. Like Length/Values.

What is a good suggested size for username, passwords, first name etc... fields. I would like to run as smooth as possible by not taking up a lot of unused space.

Thanks in advance.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Re: Suggested Database size?

Post by Burrito »

I don't know of any 'standards' for those types of fields. I usually allow my users username and password lenghts of 50. For actual information (ie real names etc), you just need to make sure it's long enough to allow for what you'd guess is the longest value possible.

ie: For first and last names I usually allow for 150 each. That's probably waaaaaaaaay bigger than any real first or last names, but in my business, sometimes people put in company names etc for their 'real' names and it's better to have the space for it than to truncate the info or worse, have mysql throw an error on an insert.
User avatar
Skoalbasher
Forum Contributor
Posts: 147
Joined: Thu Feb 07, 2008 8:09 pm

Re: Suggested Database size?

Post by Skoalbasher »

Burrito wrote:I don't know of any 'standards' for those types of fields. I usually allow my users username and password lenghts of 50. For actual information (ie real names etc), you just need to make sure it's long enough to allow for what you'd guess is the longest value possible.

ie: For first and last names I usually allow for 150 each. That's probably waaaaaaaaay bigger than any real first or last names, but in my business, sometimes people put in company names etc for their 'real' names and it's better to have the space for it than to truncate the info or worse, have mysql throw an error on an insert.
Cool beans! That's exactly how I have mine setup, just wanted to make sure I wasn't blowing a lot of space.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Suggested Database size?

Post by VladSun »

Skoalbasher wrote:just wanted to make sure I wasn't blowing a lot of space.
Why don't you use varchar(N) instead of char(N) ?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Skoalbasher
Forum Contributor
Posts: 147
Joined: Thu Feb 07, 2008 8:09 pm

Re: Suggested Database size?

Post by Skoalbasher »

VladSun wrote:
Skoalbasher wrote:just wanted to make sure I wasn't blowing a lot of space.
Why don't you use varchar(N) instead of char(N) ?
That's what I am using. Not a SQL expert, but I know a lot of commands, lol. So the Varchar will only make it as big as it is right? With a max of whatever you put in?

That saves the space no?
Post Reply