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 1r078u-003RU0-3r for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Nov 2023 21:28:20 +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 1r078s-001h3J-0U for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Nov 2023 21:28:18 +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 1r078r-001h0T-Lt for pgsql-hackers@lists.postgresql.org; Mon, 06 Nov 2023 21:28:17 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r078o-004IOv-WE for pgsql-hackers@lists.postgresql.org; Mon, 06 Nov 2023 21:28:16 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c5b7764016so67033631fa.1 for ; Mon, 06 Nov 2023 13:28:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699306093; x=1699910893; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cZYLZ04uu9L70ICUXcJxGLt6/PdwAyXuFjkaFnTCrtA=; b=eSSONU1QDCn/g5mbj+M9l4LiiMl2GH7ntpzhmGfjNcD7HUZPHaiUB+Yi2cVbqtDMMW hprMnD5h0KK1O3UfpghXAs8oWF7Lf4FqRfQBZl2fzuIT5e+AUya5WsSRIDdaoq5uaXeK jb98FI+OhNJhAP+AL90uxROKJ9Yc4cNySUw0z4ByNHmfaK5crlTOodTv2vM+JpyB23qe QhhOiK5+WgMGUFWjOKn0YYDOM0blYuyqCeiGT00lYQcurYdSasxGKJPctX7XXRXeN3GZ ZvgaFu4j4sFSU0pLPsbsyUY8Mcpv/1hM0dIcNeLmYCWo8g3SzF32PYIqYkLYi3fpnLVv WWHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699306093; x=1699910893; h=content-transfer-encoding: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=cZYLZ04uu9L70ICUXcJxGLt6/PdwAyXuFjkaFnTCrtA=; b=nqp60kuBj5Y5o5Y+MGdeG+qgob7+S5T5SyIXrN+SYATYxfbjQNJzBYUMx/HGyNnSud bvay6uhibnQKGYJZYm0+j7hGhwes5DWM5iuJih7IPG97h+C64GMk/dlXw1N4zG6qw5eM +TagYMl/gpJZ9UHrn8PWz+KVUsuZdKSwjdrr8Li82dd8+4VeKBmmXh8qYsBDwD4nakU3 rdh6heUID3zVKMO39Dgyio28CfiSEMQaDL9E59KIERoRAbDN2j5uLkRpPaedh6k/Tbmn VlENH8N+0j71XtU6ql0b7GiFk3ij1CXmEz1utSZNXFinaz1hjZiMc6YbXEtsAM0TQ0CJ 8gVg== X-Gm-Message-State: AOJu0Yz1xFhzW5fYEFU4aoPXLLePRiAsHsoj+0Ebk5oQuXkhlWefd1Ii gqTtKByOXJNwzO93FwmJzJQa1glfD0rEfd0n8vs= X-Google-Smtp-Source: AGHT+IEoPjwZBKwVSCoKazhAl4HTgrg37T/mImBWA7zbwjUhcnGEd76mCueRyHrNNdvK3AvlSPOyImVp4lkFsVY0LyY= X-Received: by 2002:a05:651c:c6:b0:2c5:1809:69ba with SMTP id 6-20020a05651c00c600b002c5180969bamr22904382ljr.40.1699306093060; Mon, 06 Nov 2023 13:28:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Matthias van de Meent Date: Mon, 6 Nov 2023 22:28:01 +0100 Message-ID: Subject: Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan To: Peter Geoghegan Cc: PostgreSQL Hackers , Tom Lane , Tomas Vondra , Jeff Davis , benoit , Alexander Korotkov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 21 Oct 2023 at 00:40, Peter Geoghegan wrote: > > On Sun, Oct 15, 2023 at 1:50=E2=80=AFPM Peter Geoghegan wrot= e: > > Attached is v4, which applies cleanly on top of HEAD. This was needed > > due to Alexandar Korotkov's commit e0b1ee17, "Skip checking of scan > > keys required for directional scan in B-tree". > > > > Unfortunately I have more or less dealt with the conflicts on HEAD by > > disabling the optimization from that commit, for the time being. > > Attached is v5, which deals with the conflict with the optimization > added by Alexandar Korotkov's commit e0b1ee17 sensibly: the > optimization is now only disabled in cases without array scan keys. > (It'd be very hard to make it work with array scan keys, since an > important principle for my patch is that we can change search-type > scan keys right in the middle of any _bt_readpage() call). I'm planning on reviewing this patch tomorrow, but in an initial scan through the patch I noticed there's little information about how the array keys state machine works in this new design. Do you have a more toplevel description of the full state machine used in the new design? If not, I'll probably be able to discover my own understanding of the mechanism used in the patch, but if there is a framework to build that understanding on (rather than having to build it from scratch) that'd be greatly appreciated. Kind regards, Matthias van de Meent Neon (https://neon.tech)