Alban Hertroys wrote:
> I have a query here for which postgres chooses a nested loop, for which
> it takes ~19s to complete in the worst-case (measured). However, if I
> disable nestloops it completes in ~400ms...
>
> It seems pretty obvious that the planner underestimates the cost of
> nestloops here, is there some way to tweak this?
Ok, I think I've figured this one out. A few order by's after the groups
in my subqueries helped a _lot_. I'm now back under 1s again.
> This is using PostgreSQL 8.1.4 on x86_64-pc-linux-gnu, compiled by GCC
> cc (GCC) 3.3.5 (Debian 1:3.3.5-13)
>
> The server is on some kind of xen domain. I have absolutely no idea what
> impact that has for various planner parameters (except that it'll
> probably not perform as well as an unxenned server), it may be relevant.
>
> The plans with and w/o nestloops respectively are attached (to prevent
> wrapping).
>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
--
Alban Hertroys
alban@magproductions.nl
magproductions b.v.
T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede
// Integrate Your World //