what does explain tell you about the query?

I also think you should try a combined index with all three columns that are used in one index. As far as I know only one index can be used per query...

B

On Aug 14, 2007, at 1:26 PM, Hugo Ferreira da Silva wrote:

hum... I get it.
But in my query, I look in 3 tables

FROM

mensagens m,
mensagenspara mp,
usuarios u,
usuarios up

WHERE

m.codmensagem = mp.codmensagem
AND u.codusaurio = m.codusuario
AND up.codusuario = mp.codusuario

m.codmensagem, u.codusaurio and up.codusuario are primary keys
mp.codusuario, m.codusuario and mp.codmensagem are indexes.

I'm joining the usuario's table twice to get the name of who is sending and
who is receiving.

I thought that creating indexes for the others columns will optimize the
results, because I'm using them in where clause.

Do you know some way to turn the response time of this query faster?


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to