Archive for the ‘mysql’ Category

MySQL Load Balancer

Wednesday, April 23rd, 2008

I'm not sure how I didn't see this earlier, but it looks like MySQL 5.1 is coming with a load balancer for replicated servers. I'm absolutely pumped about this - we've got a few sites running with multiple db slaves and it's so annoying having to check if they're ...

Decimal vs Float in MySQL

Tuesday, April 1st, 2008

While I've known how floating points are stored, I didn't know if decimal was stored any differently, or if it was more or less accurate. According to a post on the MySQL list: Bruno Rodrigues Silva wrote: > Dear all. > > The MySQL Manual inform that Decimal Data Type is used > ...

External Libraries in XCode

Wednesday, February 6th, 2008

I need to compile something and use the MySQL C++ library. I have mysql and mysql++ already compiled, I won't go over how to do that now. I added the following code to the top of my source: #include <mysql++.h> I got an error /Users/jhaddad/dev/search_engine/main.cpp:4:21: error: mysql++.h: No such file or directory Not ...

Altering tables in MySQL Cluster 5.0.45

Tuesday, November 13th, 2007

I'm setting up my first mysql cluster, and just wanted some clarification on a few things. In the manual, it says: Online schema changes. It is not possible to make online schema changes such as those accomplished using ALTER TABLE or CREATE INDEX, as the NDB Cluster engine does not support ...

Replication Issues – Duplicate Key Errors (1062)

Wednesday, October 31st, 2007

We were using replication to deal with certain queries that were producing table scans. I realize this is not a great long term solution but we were migrating a web site that was set up this way, so it wasn't really a choice. We had a database that was a ...

Checking MySQL Query Cache

Thursday, October 11th, 2007

MySQL query cache can be useful, if it works. Here's how to check it's effectiveness. show status like 'qc%'; +-------------------------+----------+ | Variable_name | Value | +-------------------------+----------+ | Qcache_free_blocks | 6407 | | ...

Innodb performance on windows?

Monday, June 11th, 2007

Let me first state that I've only run MySQL on Linux and MacOS X, never Windows. This is the first I've heard of Innodb having massive performance issues. Check out Karl Seguin's blog post.

Calculating the queries per second average in Mysql

Wednesday, May 30th, 2007

I didn't find any simple ways to determine how hard our mysql database was working, so I whipped this up. It uses a 10 second delay to figure out the queries per second average. time=10 orig=`mysql -e "show status" | awk '{if ($1 == "Questions") print $2}'` sleep $time last=`mysql -e "show status" ...

MySQL does not support variables with LIMIT in stored procedures

Thursday, May 17th, 2007

After banging my head against a wall for a while, I finally found this thread from June 2005 in the MySQL support forums regarding using variables in the LIMIT clause. They don't support it yet. There's no time table that indicates when it will be supported either. ...

Database tip: Only Counting Certain Values in an Aggregate Query

Wednesday, May 2nd, 2007

Aggregates are awesome. But sometimes you want to do 2 counts in a query, and have one of them be more restrictive than the other. Lets say our database focuses on pictures, and rating them on a scale from 1-100. We want to know the average rating, ...