Re: Planner problems in 8.2.4 and 8.2.5 (was: Possible planner bug/regression introduced in 8.2.5)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Planner problems in 8.2.4 and 8.2.5 (was: Possible planner bug/regression introduced in 8.2.5)
Date: 2007-11-06 21:18:31
Message-ID: 634.1194383911@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Greg Sabino Mullane <greg(at)turnstep(dot)com> writes:
> I don't have a full test case yet, but I did finally manage to get an
> explain analyze to finish in a sane amount of time on 8.2.5. Attached
> are two cleaned up explain analyze results, using the exact same data
> directory but different executables: one is 8.2.3 and returns as
> expected, the other is 8.2.5, which generates a slow plan despite any
> fiddling with geqo/join_collapse_limit, etc. The cost is the same, but
> it makes a wrong turn partway through the plan.

Is there a reason you rounded off most of the costs? It looks like the
estimated costs of the two join types are nearly equal, and so it's pure
chance which one gets chosen. The real problem seems to be the
misestimation here:

> ->Seq Scan on orders_smaller m (C=0..742 R=1) (AT=0..11 R=9247 L=1)
> Filter: ((order_number)::text !~~ '%.%'::text)

With a base scan estimate that's off by four orders of magnitude,
there's no reason at all to expect that the join plan above it will
be very suitable :-(

This might be a bug in the LIKE estimator (if so, it's in 8.2.3 as
well). I don't have time to look closer right now, but can you show us
the pg_stats row for orders_smaller.order_number?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-11-06 21:29:47 Re: Planner problems in 8.2.4 and 8.2.5 (was: Possible planner bug/regression introduced in 8.2.5)
Previous Message Tom Lane 2007-11-06 20:28:49 Re: BUG #3724: Duplicate values added to table despite unique index