Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI4QR-0006bG-P6 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 22:22:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VI4QR-0001mf-7d for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Sep 2013 22:22:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI4QQ-0001mW-1i for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 22:22:46 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VI4QN-0005qr-22 for pgsql-hackers@postgresql.org; Fri, 06 Sep 2013 22:22:45 +0000 Received: from intern.anarazel.de (p549F09F1.dip0.t-ipconnect.de [84.159.9.241]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id B49694E8002; Sat, 7 Sep 2013 00:22:41 +0200 (CEST) Date: Sat, 7 Sep 2013 00:22:41 +0200 From: Andres Freund To: Bruce Momjian Cc: Alvaro Herrera , Robert Haas , Peter Geoghegan , Tom Lane , Andrew Dunstan , PostgreSQL-development Subject: Re: [PERFORM] encouraging index-only scans Message-ID: <20130906222241.GB626072@alap2.anarazel.de> References: <20130904205655.GR21874@momjian.us> <20130906001437.GA29264@momjian.us> <20130906020043.GH27195@momjian.us> <20130906052236.GF6067@eldon.alvh.no-ip.org> <20130906130854.GB600952@alap2.anarazel.de> <20130906163056.GA13158@momjian.us> <20130906163647.GA626072@alap2.anarazel.de> <20130906170159.GB13158@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130906170159.GB13158@momjian.us> X-Pg-Spam-Score: -2.6 (--) 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 2013-09-06 13:01:59 -0400, Bruce Momjian wrote: > On Fri, Sep 6, 2013 at 06:36:47PM +0200, Andres Freund wrote: > > On 2013-09-06 12:30:56 -0400, Bruce Momjian wrote: > > > > 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. > > > > Yep. Although adding the table back into the fsm will lead to it being > > used for new writes again... > > You mean adding _pages_ back into the table's FSM? Yes, that is going > to cause those pages to get dirty, but it is better than expanding the > table size. I don't see why you would not update the FSM. You're right, we should add them, I wasn't really questioning that. I was, quietly so you couldn't hear it, wondering whether we should priorize the target buffer selection differently. > > > 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. > > > > Well, older tables will get vacuumed due to vacuum_freeze_table_age. So > > at some point they will get vacuumed and the vm bits will get set. > > Hmm, good point. That would help with an insert-only workload, as long > as you can chew through 200M transactions. That doesn't help with a > read-only workload as we don't consume transction IDs for SELECT. It's even 150mio. For the other workloads, its pretty "common" wisdom to VACUUM after bulk data loading. I think we even document that. > > > The more I look at this the worse it appears. How has this gone > > > unaddressed for over a year? > > > > It's been discussed several times including during the introduction of > > the feature. I am a bit surprised about the panickey tone in this > > thread. > > This December 2012 thread by Andrew Dunstan shows he wasn't aware that a > manual VACUUM was required for index-only scans. That thread ended with > us realizing that pg_upgrade's ANALYZE runs will populate > pg_class.relallvisible. > What I didn't see in that thread is an analysis of what cases are going > to require manual vacuum, and I have seen no work in 9.3 to improve > that. I don't even see it on the TODO list. Yes, TODO maybe missing. > It bothers me that we spent time developing index-only scans, but have > significant workloads where it doesn't work, no efforts on improving it, > and no documentation on manual workarounds. I have not even seen > discussion on how we are going to improve this. I would like to have > that discussion now. It's not like the feature is useless in this case. You just need to perform an extra operation to activate it. I am not saying we shouldn't document it better, but it seriously worries me that a useful feature is depicted as useless because it requires a manual VACUUM in some circumstances. > > Yes, we need to overhaul the way vacuum works (to reduce the frequency > > of rewriting stuff repeatedly) and the way it's triggered (priorization, > > more trigger conditions) but all these are known things and "just" need > > somebody with time. > Based on the work needed to improve this, I would have thought someone > would have taken this on during 9.3 development. There has been some discussion about it indirectly via the freezing stuff. That also would require more "advanced" scheduling. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers