Re: Hmm, nodeUnique doesn't really support backwards scan too well - Mailing list pgsql-bugs

From Gregory Stark
Subject Re: Hmm, nodeUnique doesn't really support backwards scan too well
Date
Msg-id 87prom2pi1.fsf@oxford.xeocode.com
Whole thread Raw
In response to Hmm, nodeUnique doesn't really support backwards scan too well  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Hmm, nodeUnique doesn't really support backwards scan too well  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> We could probably fix this by complicating the logic in ExecUnique,
> but I wonder whether it wouldn't be better to just stop treating
> Unique nodes as backwards-scannable.  The only reason for that
> node type to exist (as opposed to using Group nodes) is that it's
> simple and low-overhead.  So complicating it to support a corner case
> that no one has noticed in many years might be counterproductive.
> Thoughts?

Hm, that has the nasty side effect that someone who uses SCROLL but doesn't
fetch backwards much or at all suddenly gets a much more expensive plan than
if they didn't.

On the other hand someone who does actually use the scrollability of the
cursor to fetch forward and backwards a lot, repeatedly fetching the same
records, would actually get significantly better performance out of a
materialized result than having to skip over the duplicates repeatedly.

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

pgsql-bugs by date:

Previous
From: Markus Wanner
Date:
Subject: Re: BUG #4339: The postgreSQL service stops abnormally
Next
From: Tom Lane
Date:
Subject: Re: Hmm, nodeUnique doesn't really support backwards scan too well