Don't hold your breath waiting for that to change. To do what you're
wishing for, we'd have to treat the GROUP BY subquery as if it were an
inner indexscan, and push a join condition into it. That's not even
possible today.
Thanks! Knowing "that's not a thing" helps; we'll just have to rephras
Jay Levitt writes:
> If the query was more like
> select questions.id
> from questions
> join (
>select sum(u.id)
>from users as u
>group by u.id
> ) as s
> on s.id = questions.user_id
> where questions.id = 1;
> would you no longer be surprised that it scanned all user rows?
Don't
On Nov 10, 2011 9:26 PM, "Thom Brown" wrote:
>
> On 10 November 2011 13:05, Sorin Dudui wrote:
> > Hi,
> >
> >
> >
> > I have some functions that select data from tables which are daily or
> > monthly updated. My functions are marked as STABLE. I am wondering if
they
> > perform better if I mark
Kevin Grittner wrote:
Merlin Moncure wrote:
Well, this may not fit the OP's 'real' query
Right, if I recall correctly, the OP said it was simplified down as
far as it could be and still have the issue show.
but the inner subquery is probably better written as a semi-join
(WHERE EXISTS).
On 10 November 2011 13:05, Sorin Dudui wrote:
> Hi,
>
>
>
> I have some functions that select data from tables which are daily or
> monthly updated. My functions are marked as STABLE. I am wondering if they
> perform better if I mark they as IMMUTABLE?
No. IMMUTABLE is only appropriate when the
Hi,
I have some functions that select data from tables which are daily or monthly
updated. My functions are marked as STABLE. I am wondering if they perform
better if I mark they as IMMUTABLE?
Thank you,
Sorin