Re: BRIN index and aborted transaction

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: BRIN index and aborted transaction
Date: 2015-07-19 07:27:29
Message-ID: 20150719072729.GC2301@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-07-19 13:58:41 Re: Relation extension scalability
Previous Message Peter Eisentraut 2015-07-18 23:40:20 Re: pg_resetsysid