Jump to content


Photo

Which Collation??


  • Please log in to reply
4 replies to this topic

#1 shenniko

shenniko
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 07 February 2006 - 08:06 AM

Hi guys,

Pretty new to MySQL, ive mainly been using Access DB to do most of my Database work.

I've started building a PHP site with MySQL, and im a little stuck..

Which Collation should i be using? and whats the differance? Im using phpadmin to create all my MySQL tables and at the moment my database is auto setting the Collation to "latin1_swedish_ci".

Also, on a side note,

For my user profiles, im using TINYINT.. would that mean the max number of users it would go upto would be 9999? and if so would it be better for me to change it to BIGINT? (if i expect more than 9999 users to join my site?)

Thanks in advance

Shenn

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 07 February 2006 - 06:02 PM

You're fine with default collation. That is for supporting other languages that have different alphabets (like Chinese with their thousands of little drawn characters). If all your stuff is English, don't worry about it.

TINYINT has a maximum value of 128 signed or 256 unsigned. I would recommend you use SMALLINT UNSIGNED, which is about 65000. If you expect to (eventually) have over 65000 users, use MEDIUMINT UNSIGNED, for a maximum of nearly 17 million.

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 07 February 2006 - 07:15 PM

You might as well use INT UNSIGNED (>4 billion) -- why ever have to worry about it in the future? Besides, it's just one extra byte. No need to go with BIGINT, though -- that's just crazy.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 shenniko

shenniko
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 08 February 2006 - 09:17 AM

Sorry for the quick noob question, but whats UNSIGNED/UNSIGNED ZERO FILL etc??

Thanks in advance

shenn

#5 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 08 February 2006 - 01:10 PM

UNSIGNED means that you KNOW the number will always be a positive number. Then MySQL knows that it can store from 0 to 65000 instead of from -32000 to 32000.

UNSIGNED ZEROFILL you shouldn't have to worry about, it makes it so that when you query the value, you get something with lots of leading zeros. So if you have length set to 5 and 32 is the value in the database, MySQL returns "00032".




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users