Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joyGH-0002sf-EZ for pgsql-sql@arkaria.postgresql.org; Sat, 27 Jun 2020 00:00:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1joyGG-0006Yu-CB for pgsql-sql@arkaria.postgresql.org; Sat, 27 Jun 2020 00:00:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joyGG-0006Yn-5p for pgsql-sql@lists.postgresql.org; Sat, 27 Jun 2020 00:00:00 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1joyGD-0000Xg-E5 for pgsql-sql@lists.postgresql.org; Fri, 26 Jun 2020 23:59:58 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1joyGA-00061k-Sj; Fri, 26 Jun 2020 19:59:54 -0400 Date: Fri, 26 Jun 2020 19:59:54 -0400 From: Bruce Momjian To: Martin Handsteiner Cc: "pgsql-sql@lists.postgresql.org" Subject: Re: Optimizer Hint, to ignore limit and offset in optimizer plan Message-ID: <20200626235954.GA3324@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee