Re: [PERFORM] encouraging index-only scans

From: Jim Nasby <jim(at)nasby(dot)net>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Peter Geoghegan <peter(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PERFORM] encouraging index-only scans
Date: 2013-09-06 20:00:02
Message-ID: 522A3442.3020507@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On 9/5/13 8:29 PM, Gavin Flower wrote:
> How about a 'VACUUM AFTER' command (part of the 'BEGIN' transaction syntax?) that would:
>
> 1. only be valid in a transaction
> 2. initiate a vacuum after the current transaction completed
> 3. defer any vacuum triggered due to other criteria
>
> If the transaction was rolled back: then if there was a pending vacuum, due to other reasons, it would then be actioned.
>
> On normal transaction completion, then if there was a pending vacuum it would be combined with the one in the transaction.
>
> Still would need some method of ensuring any pending vacuum was done if the transaction hung, or took too long.

I *really* like the idea of BEGIN VACUUM AFTER, but I suspect it would be of very limited usefulness if it didn't account for currently running transactions.

I'm thinking we add a vacuum_after_xid field somewhere (pg_class), and instead of attempting to vacuum inside the backend at commit time the transaction would set that field to it's XID unless the field already had a newer XID in it.

autovac would then add all tables where vacuum_after_xid < the oldest running transaction to it's priority list.
--
Jim C. Nasby, Data Architect jim(at)nasby(dot)net
512.569.9461 (cell) http://jim.nasby.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2013-09-06 20:10:06 Re: [PERFORM] encouraging index-only scans
Previous Message Hannu Krosing 2013-09-06 19:53:33 Re: [RFC] Extend namespace of valid guc names

Browse pgsql-performance by date

  From Date Subject
Next Message Jim Nasby 2013-09-06 20:10:06 Re: [PERFORM] encouraging index-only scans
Previous Message Mark Mayo 2013-09-06 19:49:42 Re: View with and without ::text casting performs differently.