Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fCSHD-00016C-N5 for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Apr 2018 16:00:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fCSHB-0005Mg-Vt for pgsql-hackers@arkaria.postgresql.org; Sat, 28 Apr 2018 16:00:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fCSHB-0005MW-Is for pgsql-hackers@lists.postgresql.org; Sat, 28 Apr 2018 16:00:41 +0000 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fCSH7-0008GP-E5 for pgsql-hackers@postgresql.org; Sat, 28 Apr 2018 16:00:41 +0000 Received: by mail-io0-x243.google.com with SMTP id e20-v6so5841209iof.4 for ; Sat, 28 Apr 2018 09:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pE+0JuomRRwwCl1sd4i0FxxKvDLhOmzJkRUeEkrHR2c=; b=K7PLcNl0sS/P5XlKgTHRH238yA/cZ4ddtiLH778Z418I5JGpQiXdkIOodoK2Ns0ymR A/SwK/MyPTIuUDQjAdxbDkWrQq1VEoxICLuRaqDCj8CHArbTJYI5Zy7/nRFa+hUZlW+B iRxyGRonNJy29q2EaCXCM8Q683Y+kAlOBNn4QfzrflZObWneNOoqruEyWSWOp60PLIHn aQOBDuuTBwulW3CRHXrIrUTXHRwZq/qgKOazBDDn/Kttj3jFnYyVKy/CGnUpPHNZxtIv ItCMhYdEsSjm9k9Yk/SUPii+sBsGf/qYd8ncPqZSkFHKbqadbE+nC5DGlyW50MyCG02u XMNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pE+0JuomRRwwCl1sd4i0FxxKvDLhOmzJkRUeEkrHR2c=; b=YPyLDXFKnIb7JRnsILJH/JWh9+uBbGEkLI57rHJ77I0ra3XumF9RZtzlgGSUFjBv7z xbyAAjHJNcQkTZw/MoL/uNLo+vj7Br9GoVY6uECfLTxZAUT6kJsG0lGF7ymFIW378xdv jod/cQTEry69wW6S7htIMrogMnCiWdtnBo2+IxYFOFFCaR3sC7XLXmEPhtY/GiCPF+H4 nTqFT7WBqRvJLmo62GDb25eJ/CN8GmbwdeDh0X+h+Ht+14orsb1Utw9H1i2yg1HUOQ+t ufByWBIm41Wkbms/1rLAtFPStxn6PwI1FUneoxFO7m70UBMKJYZtWqxCFss6zbcG+3uj qrFg== X-Gm-Message-State: ALQs6tAAJu8yWZ+uIfUArWGkyMb8I9R3qSORphIDjq9wCxYiF6h/+0i3 AQJGHkPzoeabXcdRqBk++v5/+A== X-Google-Smtp-Source: AB8JxZpRprmS86AcOl9v4jqFqXRVWypLPkBFuCxCi0RuzaS5IqoC9r2n36cqLq4HRc6FuBu/sagAew== X-Received: by 2002:a6b:da18:: with SMTP id x24-v6mr6570706iob.296.1524931234674; Sat, 28 Apr 2018 09:00:34 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id 2-v6sm1865917iom.34.2018.04.28.09.00.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Apr 2018 09:00:33 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 0DEA0804DBD; Sat, 28 Apr 2018 11:00:32 -0500 (CDT) Date: Sat, 28 Apr 2018 11:00:32 -0500 From: Justin Pryzby To: Tom Lane Cc: Simon Riggs , Craig Ringer , Greg Stark , Amit Langote , pgsql-hackers@postgreSQL.org Subject: Re: [GENERAL] huge RAM use in multi-command ALTER of table heirarchy Message-ID: <20180428160032.GN20071@telsasoft.com> References: <946544e1-a4d7-12b5-60c6-c2b5f956ec6a@lab.ntt.co.jp> <6051.1500556750@sss.pgh.pa.us> <31269.1500420390@sss.pgh.pa.us> <20171018195454.GI17895@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171018195454.GI17895@telsasoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jul 18, 2017 at 07:26:30PM -0400, Tom Lane wrote: > > It's probably a bit late in the v10 cycle to be taking any risks in > > this area, but I'd vote for ripping out RememberToFreeTupleDescAtEOX > > as soon as the v11 cycle opens, unless someone can show an example > > of non-broken coding that requires it. (And if so, there ought to > > be a regression test incorporating that.) I'm resending this in case it's been forgotten about and in case there's still time this cycle to follow through in removing RememberToFreeTupleDescAtEOX. ..And because I ran into it again earlier this month, ALTERing an 1600 column table with 500 children (actually while rewriting to reduce to 12 childs); on a dedicated DB VM with 8GB RAM: Mar 7 11:44:52 telsaDB kernel: Out of memory: Kill process 47490 (postmaster) score 644 or sacrifice child Mar 7 11:44:52 telsaDB kernel: Killed process 47490, UID 26, (postmaster) total-vm:6813528kB, anon-rss:5212288kB, file-rss:2296kB On Wed, Oct 18, 2017 at 02:54:54PM -0500, Justin Pryzby wrote: > Hi, > > I just ran into this again in another context (see original dicussion, quoted > below). > > Some time ago, while initially introducting non-default stats target, I set our > non-filtering columns to "STATISTICS 10", lower than default, to minimize the > size of pg_statistic, which (at least at one point) I perceived to have become > bloated and causing issue (partially due to having an excessive number of > "daily" granularity partitions, a problem I've since mitigated). > > The large number of columns with non-default stats target was (I think) causing > pg_dump --section=pre-data to take 10+ minutes, which makes pg_upgrade more > disruptive than necessary, so now I'm going back and fixing it. > > [pryzbyj@database ~]$ time sed '/SET STATISTICS 10;$/!d; s//SET STATISTICS -1;/' /srv/cdrperfbackup/ts/2017-10-17/pg_dump-section\=pre-data |psql -1q ts > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while processing the request. > connection to server was lost > > [pryzbyj@database ~]$ dmesg |tail -n2 > Out of memory: Kill process 6725 (postmaster) score 550 or sacrifice child > Killed process 6725, UID 26, (postmaster) total-vm:13544792kB, anon-rss:8977764kB, file-rss:8kB > > So I'm hoping to encourage someone to commit the change contemplated earlier.