Mysql: (date) functions and indexes
Mysql is usually pretty fast by default, but to keep performance to the max sometimes requires knowledge on how mysql works and how to write queries that does their job most efficiently. Today we ran across a simple example which illustrates that mysql’s ability to use an index depends on the way you write the query. Let’s make a simple table and add an index on the date column:
create table members (
m_id integer auto_increment primary key,
m_name char(20),
m_since date not null
);
create index ix_m_since on members (m_since);