Re: [GENERAL] Lifting WHERE conditions out of inner select

2007-10-09 Thread John D. Burger
Tom Lane wrote: The planner does not look for this type of situation though, and after some study I think it'd be more trouble than it was worth. It'd be less than trivial to determine whether the upper references occurred only in places where it was safe to pull them up, and the actual pulli

Re: [GENERAL] Lifting WHERE conditions out of inner select

2007-10-08 Thread Tom Lane
"John D. Burger" <[EMAIL PROTECTED]> writes: > ... WHERE sense.synsetid > IN (SELECT synset2id FROM semlinkref > WHERE synset1id > IN (SELECT synsetid FROM sense > WHERE wordid = (SELECT wordid FROM word WHERE > lemma='scramble')) > AND linkid

Re: [GENERAL] Lifting WHERE conditions out of inner select

2007-10-08 Thread Richard Broersma Jr
OOPs! --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > --- "John D. Burger" <[EMAIL PROTECTED]> wrote: > > My question is, should the planner have figured this out, and we're > > just losing out because we're stuck in 7.4? Or is there some subtle > > difference in semantics I'm missing?

Re: [GENERAL] Lifting WHERE conditions out of inner select

2007-10-08 Thread Richard Broersma Jr
--- "John D. Burger" <[EMAIL PROTECTED]> wrote: > My question is, should the planner have figured this out, and we're > just losing out because we're stuck in 7.4? Or is there some subtle > difference in semantics I'm missing? The select results were the > same in both cases, but I'm willin

[GENERAL] Lifting WHERE conditions out of inner select

2007-10-08 Thread John D. Burger
Hi - A colleague presented the following very slow query to me: SELECT DISTINCT lemma FROM word JOIN sense USING (wordid) JOIN synset USING (synsetid) WHERE sense.synsetid IN (SELECT synset2id FROM semlinkref WHERE synset1id IN (SELECT synsetid FROM sens