SELECT me.id, me.body, me.created_at, me.channel, me.ircuser, me.vectors, ircuser.id, ircuser.name, ircuser.hostmask, ircuser.created_at, hostmask.id, hostmask.mask, hostmask.created_at, channel.id, channel.name, channel.created_at, channel.network, channel.message_count, network.id, network.address, network.port, network.created_at FROM messages me JOIN users ircuser ON ( ircuser.id = me.ircuser ) JOIN hostmasks hostmask ON ( hostmask.id = ircuser.hostmask ) JOIN channels channel ON ( channel.id = me.channel ) JOIN networks network ON ( network.id = channel.network ) WHERE ( me.created_at BETWEEN '2007-5-7 00:00:00' AND '2007-5-7 20:00:00' ) ORDER BY me.id desc LIMIT 30, 30; ----+-------------+----------+--------+--------------------------------------+---------+---------+----------------------------+-------+---------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+----------+--------+--------------------------------------+---------+---------+----------------------------+-------+---------------------------------+ | 1 | SIMPLE | network | ALL | PRIMARY,id | NULL | NULL | NULL | 3 | Using temporary; Using filesort | | 1 | SIMPLE | channel | ref | PRIMARY,id,network | network | 4 | irclogbot.network.id | 6 | | | 1 | SIMPLE | me | ref | ircuser,channel,created_at,ircuser_2 | channel | 4 | irclogbot.channel.id | 21390 | Using where | | 1 | SIMPLE | ircuser | eq_ref | PRIMARY,id,hostmask | PRIMARY | 4 | irclogbot.me.ircuser | 1 | | | 1 | SIMPLE | hostmask | eq_ref | PRIMARY,id | PRIMARY | 4 | irclogbot.ircuser.hostmask | 1 | | +----+-------------+----------+--------+--------------------------------------+---------+---------+----------------------------+-------+---------------------------------+