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