Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGppi-0000Te-9z for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2017 17:26:10 +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 1eGpph-0006Ib-Dn for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Nov 2017 17:26:09 +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 1eGpph-0006IR-57 for pgsql-hackers@lists.postgresql.org; Mon, 20 Nov 2017 17:26:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eGppa-00082A-6J for pgsql-hackers@postgresql.org; Mon, 20 Nov 2017 17:26:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAKHPrL1016115; Mon, 20 Nov 2017 12:25:53 -0500 From: Tom Lane To: Antonin Houska cc: Robert Haas , Tatsuro Yamada , "pgsql-hackers@postgresql.org" Subject: Re: [HACKERS] CLUSTER command progress monitor In-reply-to: <15653.1511197525@localhost> References: <59A77072.3090401@lab.ntt.co.jp> <15653.1511197525@localhost> Comments: In-reply-to Antonin Houska message dated "Mon, 20 Nov 2017 18:05:25 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16113.1511198753.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 20 Nov 2017 12:25:53 -0500 Message-ID: <16114.1511198753@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Antonin Houska writes: > Robert Haas wrote: >> These two phases overlap, though. I believe progress reporting for >> sorts is really hard. > Whatever complexity is hidden in the sort, cost_sort() should have taken= it > into consideration when called via plan_cluster_use_sort(). Thus I think= that > once we have both startup and total cost, the current progress of the so= rt > stage can be estimated from the current number of input and output > rows. Please remind me if my proposal appears to be too simplistic. Well, even if you assume that the planner's cost model omits nothing (which I wouldn't bet on), its result is only going to be as good as the planner's estimate of the number of rows to be sorted. And, in cases where people actually care about progress monitoring, it's likely that the planner got that wrong, maybe horribly so. I think it's a bad idea for progress monitoring to depend on the planner's estimates in any way whatsoever. regards, tom lane