Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHyw8-0002CC-52 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 16:31:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VHyw7-0000fE-G2 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 16:31:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHyw6-0000f5-9P for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 16:31:06 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VHyw1-0007j0-Rf for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 16:31:05 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1VHyvw-0002Y5-Ov; Fri, 06 Sep 2013 12:30:56 -0400 Date: Fri, 6 Sep 2013 12:30:56 -0400 From: Bruce Momjian To: Andres Freund Cc: Alvaro Herrera , Robert Haas , Peter Geoghegan , Tom Lane , Andrew Dunstan , PostgreSQL-development Subject: Re: [PERFORM] encouraging index-only scans Message-ID: <20130906163056.GA13158@momjian.us> References: <50C904DB.9090305@dunslane.net> <20121213024837.GB22363@momjian.us> <23298.1355370698@sss.pgh.pa.us> <20130904205655.GR21874@momjian.us> <20130906001437.GA29264@momjian.us> <20130906020043.GH27195@momjian.us> <20130906052236.GF6067@eldon.alvh.no-ip.org> <20130906130854.GB600952@alap2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130906130854.GB600952@alap2.anarazel.de> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Sep 6, 2013 at 03:08:54PM +0200, Andres Freund wrote: > On 2013-09-06 01:22:36 -0400, Alvaro Herrera wrote: > > I think it's shortsighted to keep thinking of autovacuum as just a way > > to run VACUUM and ANALYZE. We have already discussed work items that > > need to be done separately, such as truncating the last few empty pages > > on a relation that was vacuumed recently. We also need to process a GIN > > index' pending insertion list; and with minmax indexes I will want to > > run summarization of heap page ranges. > > Agreed. > > > So maybe instead of trying to think of VM bit setting as part of vacuum, > > we could just keep stats about how many pages we might need to scan > > because of possibly needing to set the bit, and then doing that in > > autovacuum, independently from actually vacuuming the relation. > > I am not sure I understand this though. What would be the point to go > and set all visible and not do the rest of the vacuuming work? > > I think triggering vacuuming by scanning the visibility map for the > number of unset bits and use that as another trigger is a good idea. The > vm should ensure we're not doing superflous work. Yes, I think it might be hard to justify a separate VM-set-only scan of the table. If you are already reading the table, and already checking to see if you can set the VM bit, I am not sure why you would not also remove old rows, especially since removing those rows might be necessary to allow setting VM bits. Another problem I thought of is that while automatic vacuuming only happens with high update/delete load, index-only scans are best on mostly non-write tables, so we have bad behavior where the ideal case (static data) doesn't get vm-bits set, while update/delete has the vm-bits set, but then cleared as more update/deletes occur. The more I look at this the worse it appears. How has this gone unaddressed for over a year? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers