Tag Archive: mysql

Tips About Mysql And SimpleDB

Zerofill feature of Mysql:

All rows of the field store the integer value in the same length, this feature is usable for generating invoice ID or SKU number:

create table t (t int(3) zerofill);

insert into t set t = 10;

select * from t;

+——+
| t       |
+——+
| 010|
+——+

Something about Amazon SimpleDB

Sort feature added to SimpleDB. You can use the query ORDER BY. But if you want to sort the result set by a attribute , you should judge the exist of the attribute first WHERE A IS NOT NULL AND ORDER BY A DESC.

Eventual Consistency, that means when you put some data the latency maybe 1 second or longer, you can not get the data immediately.

A cache layer is needed if your system require returning result real time.

The default collation in mysql is not always utf-8. Because the company of mysql localed in Sweden, so the encoding or collation is latin1_swedish_ci by default. You should change this feature after you installed the mysql DB server. But If you have  operated your web site for a long time, then you want to update your site for reasons. There are lots of data existed in Mysql in the encoding latin or other not UTF8. How to change the encoding or Collation to UTF-8 ?

Just download this tool to change the collation of tables or data to UTF8:

http://www.phoca.cz/phoca-changing-collation/

The Phoca Changing collation tool changes the database collation of database, tables and columns. And it is easy to use.