Re: [PERFORM] why is a constraint not 'pushed down' into a subselect when this subselect is using a 'group by' ??

2004-06-16 Thread Frank van Vugt
> We don't attempt to make every possible inference (and I don't think > you'd like it if we did). I wasn't really asking you to, either ;)) Just trying to achieve a more in-depth understanding of the way things work. > This example doesn't > persuade me that it would be worth expending the cycl

Re: [PERFORM] why is a constraint not 'pushed down' into a subselect when this subselect is using a 'group by' ??

2004-06-15 Thread Tom Lane
Frank van Vugt <[EMAIL PROTECTED]> writes: > When the 'article.id < 50' constraint is added, it follows that > 'foo.article_id < 50' is a constraint as well. Why is this constraint not > used to avoid the seqscan on package? We don't attempt to make every possible inference (and I don't think yo

Re: [PERFORM] why is a constraint not 'pushed down' into a subselect when this subselect is using a 'group by' ??

2004-06-15 Thread Frank van Vugt
> Obviously this is on toy tables The query is simplified, yes. But the data in the tables is real, albeit they're not that large. > You're misinterpreting it. I might very well be ;) But I also get the feeling I didn't explain to you well enough what I meant... > Without the group by, the pla

Re: [PERFORM] why is a constraint not 'pushed down' into a subselect when this subselect is using a 'group by' ??

2004-06-15 Thread Tom Lane
Frank van Vugt <[EMAIL PROTECTED]> writes: > If I ditch the group by, then this contraint does get pushed into the > subselect : You're misinterpreting it. Without the group by, the plan is a candidate for nestloop-with-inner-index-scan; with the group by, there's another step in the way. Pushi

[PERFORM] why is a constraint not 'pushed down' into a subselect when this subselect is using a 'group by' ??

2004-06-14 Thread Frank van Vugt
Hi all, I noticed the following. Given two tables, just simply articles and their packages: article(id int) package( id int, article_id int, amount) When taking the minimum package for articles given some constraint on the article table select article.