Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOZyU-0000kv-Hw for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 07:29:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oOZyS-0000w3-JE for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Aug 2022 07:29:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oOZyS-0000vt-9b for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 07:29:52 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oOZyM-0005jd-S4 for pgsql-hackers@lists.postgresql.org; Thu, 18 Aug 2022 07:29:50 +0000 Received: by mail-wm1-x32f.google.com with SMTP id v7-20020a1cac07000000b003a6062a4f81so2147038wme.1 for ; Thu, 18 Aug 2022 00:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=jcG6tg1d0EfmIh5pXVjM9K/uScbeSzpuDvatmE/Dyqw=; b=kxizdkBqr3vq/+2YiSTH2WERRoAqVKE5kcL9zj3PD6VjMhWmrwXdWxI1SszHwF7Uzf tk5RJoigMIwmiUGqr+1scrM3cNob7ATZ0CHxwJyK8fYlMqp108TXDVfWEpq9hsQNx/wK x97AEWUcnAkjmJDeMYcjGB66j36gd0zFeKOh+y91DpuW/GPOz7kkTxLFnJYw2tDwFfKV jFoCkOQndkeGNpDmPm6Yf0A4YNPe9ocEDPjiS28TaR50d/6TwL2mW2gSUzLsya+moE8U 9fLfVrxC+vKhMBh4XbuxuZzUFH6gODd4yr696jV80qhtivoFIuo6Uvjy25rtLdu50LPu fboQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=jcG6tg1d0EfmIh5pXVjM9K/uScbeSzpuDvatmE/Dyqw=; b=LizX07whAHNqpl4UuLfhqcUW4elMdLKbwKs5xzUkKpgSidB4p4qIzrQ8tKZSPVGlCG AsAoYmFunms9tjusEmm0PPFPFmzjkqZurrLqT3NuEXb4gZeDHD22bdwgw45H5GFLozYj rDWONxD90+bEHDrh8dAjls847JIMMuyEyUltQJQxmA6+rcUrhoeuGBX3lZr0lJPJ3vgm DFHVu6pNFHZM0ybVIQOvUYXxvPnH0aztv4ZtmfwDcEu2tkJaR3MvJZEZLhv0QtEV7swp nRkEcWbJOiBGXferM28sTkzj9majvhiv9Fg01hz8/l3KZyPoPDcj91puWgrDJ5M6I5RV 09UQ== X-Gm-Message-State: ACgBeo1IKQKkA2PA8jKBWnA/o9xo79GAFaZVhZ1rC295VjsE76vFxVn+ esLY7/tFm9KQD52YbR6AhZ/uWK6S4Kv7yLHHbyif66FObnKsZX/aEr1S9Q1cXADPukxmKxufVlj Xaw1bWBfIg7dzC6CsSQocZlVk6Xn16x6vfdJaeK7qB7yLOhPLPGHww//E7vVIsB8r7ulyaK/j4n KI/tu/YWVaNbYBoeE6nwy0kKz+/MufYwMCQJUf8gHlTL6KeioqTJcR X-Google-Smtp-Source: AA6agR5t+Mh+8Yhkxe838mMbxP1SZhpAHrsyBtSqTgJVhOFqQOk6dUV/bEx51BBwoDD8bNrSpuHCyQ== X-Received: by 2002:a05:600c:3d90:b0:3a6:161b:4d77 with SMTP id bi16-20020a05600c3d9000b003a6161b4d77mr3674507wmb.87.1660807785392; Thu, 18 Aug 2022 00:29:45 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id l28-20020a056000023c00b00225213fd4a9sm598642wrz.33.2022.08.18.00.29.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Aug 2022 00:29:44 -0700 (PDT) Message-ID: Date: Thu, 18 Aug 2022 09:29:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: POC: GROUP BY optimization Content-Language: en-US To: David Rowley Cc: Michael Paquier , Zhihong Yu , "Andrey V. Lepikhov" , Teodor Sigaev , Tomas Vondra , PostgreSQL Developers References: <721b3ff9-f214-f5d4-86c7-bae515bbec18@enterprisedb.com> <7bea462e-8c3e-0f8c-c7d5-f4daa12f3baf@postgrespro.ru> <9af89543-3d17-4c98-59de-1daa5bceeb06@enterprisedb.com> <9408e450-60c6-6fbc-d5c4-467bb0abfe67@postgrespro.ru> <44472925-f6c6-e8de-6f72-0451458532c4@enterprisedb.com> <7a80a207-5e8e-b80c-476c-2d290b0526e9@enterprisedb.com> <65941e87-86c1-c09c-8ad5-8e102aebe8ee@enterprisedb.com> <683635b8-381b-5b08-6069-d6a45de19a12@enterprisedb.com> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/18/22 03:32, David Rowley wrote: > On Thu, 18 Aug 2022 at 02:46, Tomas Vondra > wrote: >> So I don't think the current costing is wrong, but it certainly is more >> complex. But the test does not test what it intended - I have two ideas >> how to make it work: >> >> 1) increase the number of rows in the table >> >> 2) increase cpu_operator_cost (for that one test?) >> >> 3) tweak the costing somehow, to increase the cost a bit > > Why not, 4) SET parallel_setup_cost = 0; there are plenty of other > places we do just that so we get a parallel plan without having to > generate enough cost to drown out the parallel worker startup cost. > > Here are a couple of patches to demo the idea. > Yeah, that's an option too. I should have mentioned it along with the cpu_operator_cost. BTW would you mind taking a look at the costing? I think it's fine, but it would be good if someone not involved in the patch takes a look. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company