Re: Tid scan improvements

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Edmund Horner <ejrh00@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, David Rowley <david.rowley@2ndquadrant.com>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-26T16:35:33Z
Lists: pgsql-hackers
Hi,

On 2019-03-26 19:11:13 +1300, Edmund Horner wrote:
> The changes in heapam.c were required for backward scan support, as
> used by ORDER BY ctid DESC and MAX(ctid); and also for FETCH LAST and
> FETCH PRIOR.  I have removed the backward scans functionality from the
> current set of patches, but support for backward cursor fetches
> remains.
> 
> I guess to brutally simplify the patch further, we could give up
> backward cursor fetches entirely?  This means such cursors that end up
> using a TidRangeScan will require SCROLL to go backwards (which is a
> small pain for user experience), but TBH I don't think backwards-going
> cursors on CTID will be hugely common.

FWIW, I think it'd be entirely reasonable to remove support for backward
scans without SCROLL. In fact, I think it'd be wasted effort to maintain
code for it, without a pretty clear reason why we need it (unless it
were trivial to support, which it isn't).

Greetings,

Andres Freund


Commits

  1. Add TID Range Scans to support efficient scanning ranges of TIDs

  2. Improve planner's selectivity estimates for inequalities on CTID.