From: | Nicholas Piper <nick(at)nickpiper(dot)co(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: optimisation of outer join |
Date: | 2001-08-09 11:56:54 |
Message-ID: | 20010809125654.C1246@piamox7.haus |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 09 Aug 2001, Stephan Szabo wrote:
> > depos=# explain select cdtitles.title, cdtitles.artist, song,
> > fk_products_id, p.title, p.artist from cdsongs, cdtitles left join
> > products p on (cdtitles.fk_products_id = p.id) where cdtitles.cdid =
> > cdsongs.cdid and song like 'mushroom festi%';
> > NOTICE: QUERY PLAN:
>
> You're forcng the cdtitles cross products join first I believe here.
> I think you may want to force the other join first, so maybe...
>
> explain select s.title, s.artist, song, fk_products_id, p.title, p.artist
> from (cdsongs inner join cdtitles on (cdtitles.cdid=cdsongs.cdid)) s
> left join products p on (s.fk_products_id = p.id) where song like
> 'mushroom festi%';
Fantastic, that works great ! Thanks :-)
Nick
--
Part 3 MEng Cybernetics; Reading, UK http://www.nickpiper.co.uk/
Change PGP actions of mailer or fetch key see website 1024D/3ED8B27F
Choose life. Be Vegan :-) Please reduce needless cruelty + suffering !
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Hoyt | 2001-08-09 12:56:32 | An unfair comparision.... |
Previous Message | Stephan Szabo | 2001-08-09 11:50:02 | Re: optimisation of outer join |