AW: AW: VERY strange query plan (LONG)

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'Oleg Bartunov'" <oleg(at)sai(dot)msu(dot)su>
Cc: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: AW: AW: VERY strange query plan (LONG)
Date: 2000-08-10 09:15:29
Message-ID: 11C1E6749A55D411A9670001FA687963368047@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> > Your statement looks very strange (cartesian product), and
> has nothing in
> > common with the subselect statements you quoted.
>
> You're right, I simplified original query just to show plans.
> Here is original query:
> explain
> select
> txt.tid,
> tl1_0.count, tl1_0.pos[1] as pos
> from
> txt, txt_lexem1 tl1_0, txt_lexem11 tl11_0
> where
> (
> ( tl1_0.lid in (17700) and tl1_0.did=0 and txt.tid=tl1_0.tid )
> OR
> ( tl11_0.lid in (172751) and tl11_0.did=0 and txt.tid=tl11_0.tid ))
>
> order by count desc, pos asc;

That still does not lead to the same result as your subselect.
Looks like the subselect is really what you want in the first place.
The problem with above is that for the two or'ed clauses there
is no restriction for the respective 3rd table, thus still producing
a cartesian product (the and'ed clauses wont produce that,
thus correct plan for and).

A little better, but still not same result would be:
where
txt.tid=tl1_0.tid and txt.tid=tl11_0.tid and
(( tl1_0.lid in (17700) and tl1_0.did=0)
OR
( tl11_0.lid in (172751) and tl11_0.did=0))

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Kaare Rasmussen 2000-08-10 14:53:23 Re: Arrays and foreign keys
Previous Message Oleg Bartunov 2000-08-10 08:41:13 Re: AW: VERY strange query plan (LONG)