nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Re: JOIN Problem

Von: Andreas Kretschmer (akretschmer@spamfence.net) [Profil]
Datum: 05.06.2008 16:11
Message-ID: <vp8lh5-087.ln1@akretschmer.selfip.info>
Newsgroup: de.comp.datenbanken.mysql
begin  Oliver Benning schrieb:
>>> Geht das auch ohne Sub-Selects? Ich hab damit ein ziemliches
>>> Performance-Problem.
>>
>> select a.lfd_index from TabelleA a inner join (select max(lfd_index) as
>> idx from TabelleB b left join Tabellec c on (b.gruppe=c.gruppe) where
>> c.gruppe_nrP0) foo on a.lfd_index > foo.idx order by 1 limit 1;
>
> Auf meinem lokalen System liefert der SELECT ohne LIMIT 1 nur 4 Datensätze
> (obwohl in TabelleA ca. 5000 sind) in 0.05 Sekunden, auf unserem MySQL 5.1
> Cluster dauerts dann schon 30 Sekunden und es werden alle 5000 geliefert,
> obwohl einige lfd_index Nummern vergeben sind. Die Indices sind korrekt.

Ja, und? Ich hab es nicht groß getestet, vielleicht ist mein SQL ja auch
falsch. Was war das Problem mit den Subselects?


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C  http://wwwkeys.de.pgp.net
Deutsche PostgreSQL User Group: http://pgug.de

[ Auf dieses Posting antworten ]

Antworten