Archive for category mysql

mysql, umlauts and collation. Hey, o is not = ö

I came to a problem where mysql thinks that ö=o. So if your tables collation ist utf8_general_ci for example and you do

SELECT * FROM table WHERE some_field LIKE '%ö%'

You will get every row containing an “ö” but you also get every row containing an “o” (and vice versa btw).So if you really want to select the right rows you can go like this:

SELECT * FROM table WHERE some_field LIKE ('%ö%'  COLLATE utf8_bin)

Now you only get the rows containing “ö”.

Leave a comment

Amazon EC2 to assist dedicated server?

We run a dedicated server at our work. As of the last posts about optimizing it for some special cases just another idea came to my mind:
How about letting an Amazon EC2 instance assist the dedicated server twice a year for just 2-3 hours?
Thats the only time it gets critical with the workload (mostly on the mysql database).
I yet dont know how, but if i get an idea on how this could be done i will post it here.
Maybe a replicated mysql instance, maybe a memcached instance on amazon? Would be quite cheap and could really help for just this little timeframe twice a year.

Leave a comment

Memcached vs. mysql query cache

And the winner is (in this case): memcached
On my site there is a course scheduler, and today i switched one simple query to fill memcached every 5 minutes.

Before this special site took around 0.09 seconds to load,
With memcached it takes 0.047 seconds. Thats almost half the time.
When filling memcached its 0.13 seconds, so is a bit slower, but most time this little change improves the site.
The query that now gets it boost from memcached is just a query that gets date and time for a specific course, so it would run around 100 times on that page.

As i use the query cache from mysql for both queries i can say, that even if memcached is running on the same machine, memcached won for this case.
In other cases the query cache may win.

, ,

Leave a comment

%d bloggers like this: