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?

Reply via email to