Re: The optimizer is too smart for me - How can I trick it? - Mailing list pgsql-general

From Adam Rich
Subject Re: The optimizer is too smart for me - How can I trick it?
Date
Msg-id 026301c8c267$c3ecb870$4bc62950$@r@sbcglobal.net
Whole thread Raw
In response to The optimizer is too smart for me - How can I trick it?  ("Peter Vanderborght" <peter.vanderborght@taatu.com>)
List pgsql-general
> I've implemented Depesz's running total function
> (http://www.depesz.com/index.php/2007/08/17/rownum-anyone-cumulative-
> sum-in-
> one-query/) in my DB, which works great.
> Now what I want to do is get the running total for a certain statement
> and
> then do a subselect on that result so to get a non-zero start on a
> function.
>
> Instead, the optimizer sees what I'm trying to do, moves the where
> clause
> inside the subquery and my output becomes
>
> What can I do to tell the optimizer to keep its hands off my query or
> at
> least get it to not optimize?
>

I think if you add a LIMIT/OFFSET clause to your subquery, the planner
will leave it alone.





pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Mediawiki 1.10 and PG 8.3 upgrade
Next
From: Gerhard Wiesinger
Date:
Subject: Re: Tsearch2 Upgrade from 8.2 to 8.3.1 with mediawiki