Archive | January 2010

Difference between MySQL’s InnoDB and MyISAM

MySQL has two primary storange engines: MyISAM and InnoDB. Each has its own performance characteristics and considerations. In the broadest sense MyISAM is good for read-heavy data and InnoDB is good for write-heavy data, though there are cases where the opposite is true. The biggest gotcha is how the two differ with respect to the COUNT function.

ISAM = Indexed Sequential Access Method, while InnoDB is named after the engine’s creator Innobase Oy

MyISAM keeps an internal cache of table meta-data like the number of rows. This means that, generally, COUNT(*) incurs no additional cost for a well-structured query. InnoDB, however, has no such cache. For a concrete example, let’s say we’re trying to paginate a query. If you have a query SELECT * FROM users LIMIT 5,10, let’s say, running SELECT COUNT(*) FROM users LIMIT 5,10 is essentially free with MyISAM but takes the same amount of time as the first query with InnoDB. MySQL has a SQL_CALC_FOUND_ROWS option which tells InnoDB to calculate the number of rows as it runs the query, which can then be retreived by executing SELECT FOUND_ROWS(). This is very MySQL-specific, but can be necessary in certain situations, particularly if you use InnoDB for its other features (e.g., row-level locking, stored procedures, etc.).

======= BAHASA INDONESIA ========

MySQL memiliki dua mesin storange utama: MyISAM dan InnoDB. Masing-masing memiliki karakteristik performa dan pertimbangan. Dalam arti yang luas MyISAM baik untuk membaca-data (red) dan InnoDB baik untuk menulis data (write), meskipun ada kasus dimana kebalikannya yang benar. Perbedaan utama adalah bagaimana keduanya berbeda dalam penanganan fungsi COUNT.

ISAM = Indexed Sequential Metode akses, sedangkan InnoDB ini dinamakan berdasarkan penciptanya : Innobase Oy

MyISAM menyimpan cache internal tabel meta-data seperti jumlah baris. Ini berarti bahwa, pada umumnya, COUNT (*) berlangsung tanpa biaya tambahan untuk query yang terstruktur dengan baik. InnoDB, bagaimanapun, tidak memiliki cache tersebut. Untuk contoh konkret, mari kita mengatakan bahwa kita mencoba untuk penomoran pd halaman table (pagination). Jika Anda memiliki pertanyaan SELECT * FROM users LIMIT 5,10, katakanlah, menjalankan SELECT COUNT (*) FROM users LIMIT 5,10 pada dasarnya gratis dengan MyISAM tapi mengambil jumlah waktu yang sama sebagai permintaan pertama dengan InnoDB. MySQL memiliki opsi  SQL_CALC_FOUND_ROWS pada InnoDB untuk menghitung jumlah baris seperti menjalankan permintaan, yang kemudian dapat retreived dengan mengeksekusi SELECT FOUND_ROWS (). Hal ini sangat MySQL-spesifik, tetapi dapat diperlukan dalam situasi tertentu, terutama jika Anda menggunakan InnoDB untuk fitur lainnya (misalnya, tingkat baris penguncian, stored procedure, dll).

Twitter status update via curl

Sometimes,,you just need to waste your time just to sending status update to your twitter.

Here’s my suggestion to make your wasting time more wasted :),, by sending twitter status update via curl in bash scripting environment.

vi some-file.sh, and write this bunch of code :

#!/bin/bash
/usr/local/bin/curl --basic --proxy 10.2.249.250:8080 --user $1:$2 --data status="$3" twitter.com/statuses/update.xml

Then save the file using (:wq!)
give chmod +x some-file.sh to your script
Here you can call your script using :
./some-file.sh username passwd "your status"

I recommend to use (“) in your status,,,so that the script can detect that everything in between ” is your status..

have fun !