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 1mChue-0005dU-Fd for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Aug 2021 12:28:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mChuc-0002Px-A6 for pgsql-hackers@arkaria.postgresql.org; Sun, 08 Aug 2021 12:28:18 +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 1mChub-0002Po-Mu for pgsql-hackers@lists.postgresql.org; Sun, 08 Aug 2021 12:28:18 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mChuZ-0000oc-4K for pgsql-hackers@lists.postgresql.org; Sun, 08 Aug 2021 12:28:16 +0000 Received: by mail-ed1-x52e.google.com with SMTP id f13so20281581edq.13 for ; Sun, 08 Aug 2021 05:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dNEERsj9sjhiRzCiu0wlz/CjdjNGJIJOffvmLlWRYo8=; b=BzpC0MceCxAPiho0og0cJGvN8MTcNV28bSjH+5UWSF8MFPgU2zkxjthv1BEFzoy7oB qdqQV/uhV5gyvGvJjmU5pKsmPXkJJ8s9j6GajyXlIPwUKWIKM4BDCnMd0EHccRTN7aj3 4dAzskP2fgg7pbkrnHR/TNfFIluvzB4aYAXiMqbDwb5I11hm1+UdeBP1L5dGLF9eXQpB W36CPvZVUhYWgBaBujdQ1j/Z7msZGfpEiNLIQJL8gLPeS3p0rZ++OZyqL5oV571uhTG7 g73NZfZB4JPhz2mffp6+A/9u9Dlfux2EKwzK4aw0t8SGW/ELrj7VzVdahQ9dapOFIIcF aA7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dNEERsj9sjhiRzCiu0wlz/CjdjNGJIJOffvmLlWRYo8=; b=qfRS090fzK579it9XhUr4bJQYOn9eZyO8kX7Rx1ALZGM0FKZUhzOwMb5HgFo2LMS40 1GpoqHDCk8hVAGUIF5dhN0XUIpTMaOxTaO1skOytbSpcNwiYh8dY+ahIukv1iUTBv+8M bbN0ZgmBEQDbAG884Gc1FjQLfO2FTXUw0m6adj6n3OlOPK+HTA3tVZKX97Ku+ZEJC3Yt j7NU5+QGtpSjnSECiUOyoDnOakdssQhIRLuby9QPvN14zPfzikqhW47hGZAyhm0mTN/h CBuN8nWquBJbgJY/QzMIpcUujoXtZJaIsCdxiXeLGuCgbLI74ilRz/B2PWKkEQc+oX7u 6qOg== X-Gm-Message-State: AOAM5330pDb19kJ3CrT/o1Xq9kZ5Subsc2xKCMZ5g0b2mrm4oXjC7dMH DZtba1WguTNQRlAmPwguISqJqkbnzWI7cWDIDP44XaODaH15fQwG/C3mW8e9Wi+iev02jL7ouaJ kVsODImo88om+0Q2B9+C6KP8OlgHuEpSBCRZ+OcLYGJKtBbPbK9ZdkT3MLJGY6UkTXcf3LkFqjS 6FnIFBL4vLRlM410ckd+241j7uTsNi1FNE2Mr4t4zOF4TbERjxe/E1539uSrOecG4uc0wMBbh9K pp1O9vqOfAOYy3yS08k2T/K1AWru5I+XiNxiq5Y140/lP66cCOd+w== X-Google-Smtp-Source: ABdhPJz8Qv+wV6v86lN2WOGzXlsiElc08qNrdYehr/PgAaxNH811HVZU3fs1B+VAwYCFiHcziYkP5g== X-Received: by 2002:a05:6402:1d19:: with SMTP id dg25mr1025453edb.153.1628425692639; Sun, 08 Aug 2021 05:28:12 -0700 (PDT) Received: from [10.137.0.18] (ip-86-49-254-183.net.upcbroadband.cz. [86.49.254.183]) by smtp.gmail.com with ESMTPSA id c28sm4929554ejc.102.2021.08.08.05.28.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Aug 2021 05:28:12 -0700 (PDT) Subject: Re: Use generation context to speed up tuplesorts To: David Rowley Cc: Andres Freund , Tomas Vondra , PostgreSQL Developers References: <20210730203853.utjj43f6zzn5e2hy@alap3.anarazel.de> <36829a8a-63d0-c428-89d5-07e49561973e@enterprisedb.com> <13808af0-2bb5-b506-62d0-1fb67e3385d0@enterprisedb.com> From: Tomas Vondra Message-ID: <330e3918-df5c-1ef5-01bb-d3387d12e86d@enterprisedb.com> Date: Sun, 8 Aug 2021 14:28:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US 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/8/21 9:02 AM, David Rowley wrote: > On Sat, 7 Aug 2021 at 12:10, Tomas Vondra wrote: >> >> On 8/6/21 3:07 PM, David Rowley wrote: >>> All of the tests show that the patches to improve the allocation >>> efficiency of generation.c don't help to improve the results of the >>> test cases. I wondered if it's maybe worth trying to see what happens >>> if instead of doubling the allocations each time, quadruple them >>> instead. I didn't try this. >>> >> >> I doubt quadrupling the allocations won't help very much, but I suspect >> the problem might be in the 0004 patch - at least that's what shows >> regression in my results. Could you try with just 0001-0003 applied? > > But 0004 only changes the logic which controls the threshold of when > we allocate an oversized chunk. It looks like the threshold is 512KB > with the 0004 patch. My test is only doing a maximum allocation of > 296 bytes so will never allocate an oversized chunk. > > Can you explain why you think 0004 would cause performance regressions? > It's based solely on results of my benchmarks, where this patch seems to cause performance regression. I agree it's a bit bizzare, considering what the patch does. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company