Re: Optimizing away second VACUUM heap scan when only BRIN indexes on table

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimizing away second VACUUM heap scan when only BRIN indexes on table
Date: 2015-12-21 01:13:25
Message-ID: 56775235.5090009@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/23/15 5:06 PM, Peter Geoghegan wrote:
> I realize that the second scan performed by lazy_vacuum_heap() only
> visits those pages known to contain dead tuples. However, the
> experience of seeing problems with the random sampling of ANALYZE
> makes me think that that might not be very helpful. There is no good
> reason to think that there won't be a uniform distribution of dead
> tuples across the heap, and so only visiting pages known to contain
> dead tuples might be surprisingly little help even when there are
> relatively few VACUUM-able tuples in the table.

Even worse is if you can't fit all the dead TIDs in memory and have to
do multiple passes for no reason...

> Has any thought been given to how we could make VACUUM avoid a second
> heap scan iff there are only BRIN indexes, without compromising
> anything else? In other words, by killing heap TIDs*before* any
> "VACUUM" of BRIN index(es) occurs, avoiding a call to
> lazy_vacuum_heap(), just as when there are no indexes on the table
> whatsoever?

ISTM the big question here is how vacuum would know it can skip this
since we wouldn't want to hard-code this for BRIN.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2015-12-21 01:39:48 Re: Typo in the comment above heap_prepare_freeze_tuple()
Previous Message Thomas Munro 2015-12-21 00:35:54 Re: Making tab-complete.c easier to maintain