From explain you can see that your problem lies within the mensagens
table (the first entry from your explain query) where it says type:
ALL and rows 68337. This basically means that it is not using any
index for this table.
MySQL doesn't seem to be very smart about queries involving OR and
things like <>. For me creating temporary tables or writing perl
scripts to do the job solved my particular problems. But I am working
with tables that don't change but have some 100,000,000 rows...
I guess I suggest, introducing some redundancy and removing the OR
statement could help in your case...
B
On Aug 14, 2007, at 2:19 PM, Hugo Ferreira da Silva wrote:
ype: ALL