Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqAbx-007W0h-5S for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2024 12:13:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sqAbv-00FV6u-5K for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Sep 2024 12:13:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqAbu-00FV6g-Cr for pgsql-hackers@lists.postgresql.org; Mon, 16 Sep 2024 12:13:42 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqAbm-001ROh-JU for pgsql-hackers@postgresql.org; Mon, 16 Sep 2024 12:13:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=7KNX4GmtntqRSff1VwJ4gJVj0salyO24RliltBkVBkE=; b=rJs+5SqLHVpovIncj44ofNQgxn vzIbxtQUlnwxu0Vr2nKZyW/7HUrNNRMWrq4hCExjN3MOvzTei6LGb4/X18Km8BDOCdPgROmDdufpF BSwrS/njqJNForLVW+a5fE0lMTysF7wiZK5b1PyawlffcSrRbgOBy+79wqOen8UcW+AvaK6H8N7XA kvAftdImj13UI/88F0EyFHtE9fCrdJDleXiG0Kvlae62jx5sJTHGnXCXenQRYbRfm/9y9+mbpSB2j Me8qUJSiiKRZLMNwt6p6P/+xkVbcmNNqWYvRvFUkg47EG3hvM7bSlfQionNpks/50uzveTtfl1yiN ohDZhH0g==; Received: from 4.140.178.217.shared.user.transix.jp ([217.178.140.4] helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqAbi-003RCs-3a; Mon, 16 Sep 2024 12:13:33 +0000 Date: Mon, 16 Sep 2024 21:13:17 +0900 (JST) Message-Id: <20240916.211317.396133556663707937.ishii@postgresql.org> To: ashutosh.bapat.oss@gmail.com Cc: dgrowleyml@gmail.com, orlovmg@gmail.com, jian.universality@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN From: Tatsuo Ishii In-Reply-To: References: <20240914.171201.2241093933296787263.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Ashutosh, Thank you for the review. > Thanks. This will do. Is there a way to force the larger partition to > be computed first? That way we definitely know that the last > computation was done when all the tuples in the tuplestore were in > memory. Not sure if there's any way to force it in the SQL standard. However in term of implementation, PostgreSQL sorts the function (generate_series) scan result using a sort key "a.n < 3", which results in rows being >= 2 first (as false == 0), then rows being < 3 (as true == 1). So unless PostgreSQL changes the way to sort boolean data type, I think the result should be stable. Best reagards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp