From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | "Prodan, Andrei" <Andrei(dot)Prodan(at)awinta(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: 'Interesting' prepared statement slowdown on large table join |
Date: | 2011-05-12 23:28:42 |
Message-ID: | BANLkTimw37BOr17G54KMS6r8cPZmTKnKkg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Thu, May 12, 2011 at 8:53 AM, Prodan, Andrei
<Andrei(dot)Prodan(at)awinta(dot)com> wrote:
>
> @Jeff: thank you for the clear plan interpretation - but I'm afraid I
> don't really understand the second bit:
> 1) I provided the GOOD plan, so we already know what postgres thinks,
> right? (Later edit: guess not. Doesn't work)
> 2) There's no full table scan in any of the plans - it scans indices,
> the problem seems to be that it scans them in the wrong order because it
> thinks there are very few WHERE matches in big_table - which is
> incorrect, as for that particular pair there is a huge amount of rows.
Hi Andrei,
"Explain analyze" only gives you the cost/rows for the plan components
it actually executed, it doesn't give you costs for alternative
rejected plans. Since the GOOD PLAN doesn't include the index scan in
question, it doesn't give the estimated or actual rows for that scan
under the stats/conditions that provoke the GOOD PLAN to be adopted.
So to get that information, you have to design an experimental
prepared query that will get executed using that particular scan, that
way it will report the results I wanted to see. My concern is that
the experimental query I proposed you use might instead decide to use
a full table scan rather than the desired index scan. Although come
to think of it, I think the same code will be used to arrive at the
predicted number of rows regardless of whether it does a FTS or the
desired index scan.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2011-05-13 00:10:11 | Re: tuning on ec2 |
Previous Message | Samuel Gendler | 2011-05-12 23:10:19 | setting configuration values inside a stored proc |