MySQL Forums
Forum List  »  Italian

Re: TEMPI LUNGHISSIMI DI RICERCA - AIUTO
Posted by: Michele Abbondanza
Date: September 17, 2008 02:39AM

ciao
scusa per il ritardo con cui rispondo alla tua domanda..
allora, il problema secondo me sta nell'ottimizzazione del database in funzione di questa specifica select.
nel manuale di riferimento in inglese è specificato esplicitamente un caso come il tuo:
SELECT left_tbl.*
FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id
WHERE right_tbl.id IS NULL;

This example finds all rows in left_tbl with an id value that is not present in right_tbl (that is, all rows in left_tbl with no corresponding row in right_tbl).

sei sicuro che:
"This assumes that right_tbl.id is declared NOT NULL."??

se proprio non è il tuo caso, prova a vedere se tutte queste condizioni sono soddisfatte: http://dev.mysql.com/doc/refman/5.0/en/left-join-optimization.html

ricorda inoltre che la left join fa una scansione completa della tabella "di destra" prima di iniziare la computazione, quindi se questa tabella è particolarmente "affollata" il collo di bottiglia potrebbe essere lì, oppure come cita uno dei primi commenti:

In my case query worked very slow when "the outer" table had utf8 joining columns, and a second table had latin1 ones.
Though, query worked fast when the outer table had latin1 joining columns, and a second table had utf8 ones.Join was efficient in any direction when columns that tables outer joined were the same character set, ether both latin1, or both utf8.

insomma, di lavoro ce n'è e le possibilità sono tante, facci sapere qual'era il problema.. sono curioso :)

Options: ReplyQuote


Subject
Views
Written By
Posted
3619
September 05, 2008 08:43AM
Re: TEMPI LUNGHISSIMI DI RICERCA - AIUTO
2661
September 17, 2008 02:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.