Try SELECT tableA.* FROM tableA WHERE NOT EXISTS (select * from tableA, tableB, tableC where tableA.id <> tableB.idA and tableA.id <> tableC.idA)
-----Original Message----- From: Ralf Narozny [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 25, 2002 2:46 PM To: Guilherme Cc: [EMAIL PROTECTED] Subject: Re: Performance Problem - LEFT JOIN Guilherme wrote: >I have 3 tables tableA, tableB and tableC and the fields tableA.id, >tableB.idA and tableC.idA. >I'm using this query (bellow) to call information from the database that has >in tableA but tableA.id is not found on tableB.idA and tableC.idA. > >SELECT tableA.* > FROM tableA > LEFT JOIN tableB ON (tableB.idA = tableA.id) > LEFT JOIN tableC ON (tableC.idA = tableA.id) > WHERE tableB.idA IS NULL AND tableC.idA IS NULL; > >With a low ammount of data (30 records) I receive the data really fast. >However with a greater ammount of data (1800 records) it takes 26 seconds to >return data and it consumes 100% of processor. This situation happens when I >have all tableA.id registered on tableB.ida or tableC.ida. > >Any ideas? > > > Of course you have indexes on all of the id, idA, idB columns? Greetings Ralf sql, query -- Ralf Narozny SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php