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 1qphe3-006dDj-Iy for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Oct 2023 04:13:27 +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 1qphe1-00ANdQ-EG for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Oct 2023 04:13:26 +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 1qphe1-00ANdH-3w for pgsql-hackers@lists.postgresql.org; Mon, 09 Oct 2023 04:13:26 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qphdz-000j4c-Pg for pgsql-hackers@lists.postgresql.org; Mon, 09 Oct 2023 04:13:24 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5046bf37ec1so5365675e87.1 for ; Sun, 08 Oct 2023 21:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696824801; x=1697429601; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YdJQsitR5HHecYM9tEpTBp78d6Dsz4e9FWHdT+xfx80=; b=hVf5o/nDTySKnUFd+uvKfxpyA5r4fMOn0RmcSzsXooWldoo/QrJIgrauroJTeOQo/C oD4Prt3Ox+wVn/r10Si8CkbPAsYTsjaUXNk7TFvOG2DrBGPfeYzHdCCkbyKtsp2SGg+j alIYDSKPgvzLsTStWrTrwXoLtJ+p/PHTzvyHY1D92l/gVCWCMc4HepCcphDHM239RaMZ OQz+EJKHS49ngUjoXW9WDxrQEvcago0b87gEV/CTvAOvp7ImlpE2+omleWgW9saN1YPD Y/ZHAZGdNGWrDSOmByg9EXhCnxCgPzp5V5NLdojmS3aAZRUwngjIq5Zj/pWTL3Ig0T2E uxMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696824801; x=1697429601; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YdJQsitR5HHecYM9tEpTBp78d6Dsz4e9FWHdT+xfx80=; b=QTGj/kudCyMqT+vGxTmAWQp6T9zWCrNC4/t56voKzSiCVZwJFUJgGjgj4s+3XtkKd8 Ix0uyuvf16HzioEpS53KnsRC4TWLqamYN/M9ns6RTnN6Yk4nhi6QX9EoAYRFFKJRSKlk sHYYKXAAGQAwJAkTvMK1aJZ10PIcbZ2c911ho67cvXMBOXZCG2kOcsRAaoaHR1kfgeu8 uCRGFi6z9T9r+adiHvUd7kK2iyEWQGOZZpBTf2kssSJcjUqoqtgJ5Hx3omCYRDEJwEks MQ0pcZZ5YUnoELtstfts4l5bTybv5WdkhJZELLawKBRVoP6GSy9C7HkR0aXS6ihvaVXO oneg== X-Gm-Message-State: AOJu0Yw5csnFDt8stlT2iZzvekSexP2xBIVCmSdkggmdLc9zl9nIkHjg awkoxaaRk7OQHq4jX9yeL0xBp7ZItAOcOWOfqAM= X-Google-Smtp-Source: AGHT+IGcQ3X5Wrd6zHkcdv9vFI/hNgwHLxQ2uKE/4FfcruU76sEFBKhoW7lLkUHWoaXgmBP4Aefj/pf42EzY4TxY3/o= X-Received: by 2002:a05:6512:102a:b0:503:9c2:e44e with SMTP id r10-20020a056512102a00b0050309c2e44emr9963190lfr.55.1696824800873; Sun, 08 Oct 2023 21:13:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Rowley Date: Mon, 9 Oct 2023 17:13:09 +1300 Message-ID: Subject: Re: pg16: XX000: could not find pathkey item to sort To: Richard Guo Cc: Justin Pryzby , pgsql-hackers@lists.postgresql.org Content-Type: multipart/mixed; boundary="00000000000080e2c6060740cfa2" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000080e2c6060740cfa2 Content-Type: text/plain; charset="UTF-8" On Mon, 9 Oct 2023 at 12:42, David Rowley wrote: > Maybe it's worth checking the total planning time spent in a run of > the regression tests with and without the patch to see how much > overhead it adds to the "average case". I've now pushed the patch that trims off the Pathkeys for the ORDER BY / DISTINCT aggregates. As for the patch to verify the pathkeys during create plan, I patched master with the attached plan_times.patch.txt and used the following to check the time spent in the planner for 3 runs of make installcheck. $ for i in {1..3}; do pg_ctl start -D pgdata -l plantime.log > /dev/null && cd pg_src && make installcheck > /dev/null && cd .. && grep "planning time in" plantime.log|sed -E -e 's/.*planning time in (.*) nanoseconds/\1/'|awk '{nanoseconds += $1} END{print nanoseconds}' && pg_ctl stop -D pgdata > /dev/null && rm plantime.log; done Master: 1855788104 1839655412 1740769066 Patched: 1917797221 1766606115 1881322655 Those results are a bit noisy. Perhaps a few more runs might yield more consistency, but it seems that there's not too much overhead to it. If I take the minimum value out of the 3 runs from each, it comes to about 1.5% extra time spent in planning. Perhaps that's OK. David --00000000000080e2c6060740cfa2 Content-Type: text/plain; charset="US-ASCII"; name="plan_times.patch.txt" Content-Disposition: attachment; filename="plan_times.patch.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lnidisxf0 ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL29wdGltaXplci9wbGFuL3BsYW5uZXIuYyBiL3NyYy9i YWNrZW5kL29wdGltaXplci9wbGFuL3BsYW5uZXIuYwppbmRleCAxZTRkZDI3ZGJhLi4zYzcxMzc4 MmYxIDEwMDY0NAotLS0gYS9zcmMvYmFja2VuZC9vcHRpbWl6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