Re: BRIN index and aborted transaction - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: BRIN index and aborted transaction
Date
Msg-id 20150719072729.GC2301@postgresql.org
Whole thread Raw
In response to Re: BRIN index and aborted transaction  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> Tatsuo Ishii wrote:
> 
> > When a transaction aborts, it seems a BRIN index leaves summary data
> > which is not valid any more. Is this an expected behavior?  I guess
> > the answer is yes, because it does not affect correctness of a query
> > result, but I would like to make sure.
> 
> You're right, that is not rolled back (just like any other index type,
> actually).

Let me clarify this a bit.  Summarization normally takes place during
vacuum (or upon the brin_summarize_new_ranges() function being called on
the table).  If the INSERT adds tuples to a page in a range that has
already been summarized, then the summary tuple for that page range will
be updated to cover the to-be-aborted tuples.  On the other hand, if the
INSERT adds tuples to a page that is not summarized, there is no summary
tuple to update; and the subsequent vacuum will remove those tuples
before summarizing the range, so they will not appear in the summary
tuple.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pg_resetsysid
Next
From: Andres Freund
Date:
Subject: Re: Relation extension scalability