mysql - What's is better for a members database? -
hi , thanx reading post having little trouble learning database in mysql. have set recently, had person tell me members table slow , useless if intend have lots of members!
i have looked on lot of times , did google searches don't see wrong it, maybe because new @ it? can 1 of sql experts on , tell me whats wrong please :)
-- -- table structure table `members` -- create table if not exists `members` ( `userid` int(9) unsigned not null auto_increment, `username` varchar(20) not null default '', `password` longtext, `email` varchar(80) not null default '', `gender` int(1) not null default '0', `ipaddress` varchar(80) not null default '', `joinedon` timestamp not null default current_timestamp on update current_timestamp, `acctype` int(1) not null default '0', `acclevel` int(1) not null default '0', `birthdate` date default null, `warnings` int(1) not null default '0', `banned` int(1) not null default '0', `enabled` int(1) not null default '0', `online` int(1) not null default '0', primary key (`userid`), unique key `username` (`username`), unique key `emailadd` (`emailadd`) ) engine=myisam default charset=latin1 auto_increment=19 ; -- -- dumping data table `members` --
it's going site faqs/tips games, expect lots of members @ 1 point later on thought ask make sure it's ok, thanx again peace.
did other person explain why think slow , useless?
here's few things think improved:
email
should longer - off top of head, 320 should long enough email addresses, might want up.
if int(1)
fields simple on/off fields, tinyint(1)
or bool
instead.
as @cularis points out, ipaddress
field might not appropriate type. int unsigned
better varchar ipv4. can use inet_aton()
, inet_ntoa()
conversion. see:
best field type ip address?
how store ipv6-compatible address in relational database
as @delan azabani points out, password
field long value storing. md5 produces 32 character string, varchar(32)
sufficient. switch more secure sha2, , use mysql 'sha2()' function.
look using innodb database engine instead of myisam. offers foreign key constraints, row-level locking , transactions, amongst other things. see should move myisam innodb ?.
Comments
Post a Comment