データベースは,大量のデータを格納して目的に合わせて処理するのが役割である。処理を高速化する機能として,インデックスが用意されている。インデックスは,あらかじめ検索やソート対象となる列のデータを処理しやすいように別管理するものだ。インデックスを使いこなせるかどうかで,データベース処理の良し悪し決まるといっても過言ではない。しかし,インデックスいつまでも高速ではない。その効果が,色褪せる時がやってくるのだ。 インデックスの効用 まずは,肩慣らしにインデックスの効用を確認する。テーブル「pono」は,日本郵政グループの日本郵便事業株式会社が提供している郵便番号データを格納したテーブルだ。 図1●テスト用のテーブル「pono」 mysql> show create table pono \G *************************** 1. row *****************