On Thu, Apr 26, 2012 at 8:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> So, as a first step, I've committed a patch that just throws a hard
> conflict. I think we probably want to optimize this further, and I'm
> going to work investigate that next. But it seemed productive to get
> this much out of the way first, so I did.
I've been thinking about this some more. What's worrying me is that a
visibility conflict, however we implement it, could be *worse* from
the user's point of view than just killing the query. After all,
there's a reasonable likelihood that a single visibility map page
covers the whole relation (or all the blocks that the user is
interested in), so any sort of conflict is basically going to turn the
index-only scan into an index-scan plus some extra overhead. And if
the planner had known that the user was going to get an index-only
scan rather than just a plain index scan, it might well have picked
some other plan in the first place.
Another problem is that, if we add a test for visibility conflicts
into visibilitymap_test(), I'm afraid we're going to drive up the cost
of that function very significantly. Previous testing suggests that
that efficiency or lack thereof of that function is already a
performance problem for index-only scans, which kinda makes me not
that excited about adding another branch in there somewhere (and even
less excited about any proposed implementation that would add an
lwlock acquire/release or similar).
So on further reflection I'm thinking it may be best just to stick
with a hard conflict for now and see what feedback we get from beta
testers.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company