Archive for the ‘Uncategorized’ Category

How to Test Disk IO Speed with a Large Temp File

Tuesday, October 21st, 2008

Create a 1GB temp file fast:

time dd if=/dev/zero of=FileOfZeros.txt bs=1024k count=1024

Useful for testing disk IO speed.

Troubleshooting a MySQL query

Tuesday, April 1st, 2008

Use EXPLAIN to show which indexes are being used.

mysql> EXPLAIN SELECT mycolumns FROM table1 LEFT JOIN table2;\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: ag
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 1010
Extra:
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: zsg
type: ALL
possible_keys: NULL
key: NULL
key_len: NULL
ref: NULL
rows: 361
Extra:
*************************** 3. row ***************************
id: 1
select_type: SIMPLE
table: ads
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: database.table.column
rows: 1
Extra:
*************************** 4. row ***************************
id: 1
select_type: SIMPLE
table: account_networks
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: database.table.column
rows: 1
Extra:
*************************** 5. row ***************************
id: 1
select_type: SIMPLE
table: accounts
type: eq_ref
possible_keys: PRIMARY
key: PRIMARY
key_len: 4
ref: database.table.column
rows: 1
Extra:


6 rows in set (0.00 sec)