Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRItp-0002rZ-GY for pgsql-admin@arkaria.postgresql.org; Tue, 19 Dec 2017 14:29:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRIto-0006Zk-Io for pgsql-admin@arkaria.postgresql.org; Tue, 19 Dec 2017 14:29:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eRIto-0006Zb-8S for pgsql-admin@lists.postgresql.org; Tue, 19 Dec 2017 14:29:40 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eRItk-0005Iw-Hq for pgsql-admin@lists.postgresql.org; Tue, 19 Dec 2017 14:29:38 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 4E7FBC0D31; Tue, 19 Dec 2017 14:29:34 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo01-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sh1xgB15xYK5; Tue, 19 Dec 2017 14:29:34 +0000 (UTC) Received: from [192.168.2.16] (unknown [8.39.228.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 07A96C0D1C; Tue, 19 Dec 2017 14:29:31 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: Estimate maintenance_work_mem for CREATE INDEX From: scott ribe In-Reply-To: Date: Tue, 19 Dec 2017 07:29:29 -0700 Cc: pgsql-admin@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <76272163-2E25-4997-9D6F-983F0BBA5885@elevated-dev.com> References: To: Greg Stark X-Mailer: Apple Mail (2.3273) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Dec 19, 2017, at 7:14 AM, Greg Stark wrote: >=20 > I'm not clear how you would determine how much memory is needed to > sort a table without actually doing the sort though. So that would be > more of an EXPLAIN ANALYZE wouldn't it? I'd think EXPLAIN could use a quite rough approximation, say based on a = rather sparse random sampling of values. EXPLAIN ANALYZE might involve a = whole table scan, or might involve more dense sampling. -- Scott Ribe https://www.linkedin.com/in/scottribe/ (303) 722-0567