Re: Optimizer Hint, to ignore limit and offset in optimizer plan

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Martin Handsteiner <martin.handsteiner@sibvisions.com>
Cc: "pgsql-sql@lists.postgresql.org" <pgsql-sql@lists.postgresql.org>
Date: 2020-06-26T23:59:54Z
Lists: pgsql-sql
On Fri, Jun 26, 2020 at 08:49:19AM +0000, Martin Handsteiner wrote:
> Hello,
> 
>  
> 
> I’m aware, that taking limit and offset into account of optimizer plan is not a
> bug.
> 
> Nevertheless it is very often an unwanted feature.
> 
> As the postgres db has the issue with not supporting cursors over commit/
> rollback, it is necessary to use the limit and offset mechanism.

Uh, have you considered WITH HOLD cursors:

	WITH HOLD specifies that the cursor can continue to be used after the
	transaction that created it successfully commits.  WITHOUT HOLD
	specifies that the cursor cannot be used outside of the transaction that
	created it. If neither WITHOUT HOLD nor WITH HOLD is specified, WITHOUT
	HOLD is the default.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee