Jump to content

Archived

This topic is now archived and is closed to further replies.

shenniko

Which Collation??

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sorry for the quick noob question, but whats UNSIGNED/UNSIGNED ZERO FILL etc??

Thanks in advance

shenn

Share this post


Link to post
Share on other sites
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".

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.