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 1swZ2U-004Y7c-L3 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2024 03:31:35 +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 1swZ2T-009H9x-Lt for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2024 03:31:33 +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 1swZ2T-009H9p-By for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2024 03:31:33 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1swZ2Q-002O3P-DS for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2024 03:31:32 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20b49ee353cso15879455ad.2 for ; Thu, 03 Oct 2024 20:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728012689; x=1728617489; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kYm4axv9yAe43RI/qp66vgCaBdvs/wWMEzpndmkHEtU=; b=N9hnUMfUw3FyMogcXfNSz9Xd+QDKCrPxsdTleDNmFF+8r6XJy7Mfao9AxcH34OzYuu qchGgW902YtUogB2YoT5wI0Kw88cgxpMB9S3smg4htb1xvIJd79R6Atx0TkegbyuENGo wRI20tOzlnGfv2myyVgfkqzmOZhxKj5uxFvlTlQu2hzA4qhr5ZqU3Br7eo6FtCkawG22 j6guV+fjJFuiKVhCqcmPpGwhSH1vnc3gjWXlf3EEVPeREShZZ+Iv3wqv4dEsTZgmAoOW bTE/dupQNaQS/4LSRtm1ycGpCjv33ayBUl6db+lU0WldBtkxhGFNF7MjJ5otcCIESmjD kvMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728012689; x=1728617489; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kYm4axv9yAe43RI/qp66vgCaBdvs/wWMEzpndmkHEtU=; b=rcb3QjVknuApUO/5qRks0ZIVfFfCiBm8z+7gkmMlNhG1oHmWe0TvQX+PfeZtUyxiko nadbRUliFr47gGIxbUEVJrbUhncUpkwDdI1lcHY2JrDCcdLSP4myORhu/uA7vsMOMg06 wPSw3/e8g7a5TjL46L2cNvUAueyt6odCUSwcydbIJMfz6y/UGR14bx5wfIfMPo3Tkki9 5LrgyMYlWDFyMMy5g6oBk14GC8+c3hjlVY/BMYjCvK6qzFvhuO6lgDapG147hLxtDE0N EseXR2DNaykhmPvXjvFWbtKKodIoYNPknpQdnpY/ib5uU0f3PvuHwG6Ua2vi+J4ieuyG WClg== X-Forwarded-Encrypted: i=1; AJvYcCXZBXUguCuglKbgTS+ESV+VDH7fOJNmrT7dPUFzx+v+OalcUTOXqZ93xxb6yjdgAM/KipzZn/GloytiqYMv@lists.postgresql.org X-Gm-Message-State: AOJu0YyzOr/OnKGN81B8qboPOlOzl5b8dHs3uzY5jPy+YkwkfVam4gjN Go8a5qW3JwodQfce8GdHPd2+t/Wcr+zivOOX4XG4XTZKBNmknyG0 X-Google-Smtp-Source: AGHT+IEZp1j+JUoVglsKMNo6fP/SH2WxMt5b53MgK7SVN5Z68gTGBlo/Hf89kh2sqHdFgzD8ztN5Pg== X-Received: by 2002:a17:902:ea11:b0:202:28b1:9f34 with SMTP id d9443c01a7336-20bff04acbemr16325885ad.56.1728012689292; Thu, 03 Oct 2024 20:31:29 -0700 (PDT) Received: from [10.10.20.99] (node-nz0.pool-125-26.dynamic.totinternet.net. [125.26.121.92]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20beead205asm15975395ad.18.2024.10.03.20.31.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Oct 2024 20:31:28 -0700 (PDT) Message-ID: <1d5131fc-cd6c-4f61-8ba0-e61c518b168d@gmail.com> Date: Fri, 4 Oct 2024 10:31:22 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC, WIP: OR-clause support for indexes To: Peter Geoghegan , Alexander Korotkov Cc: Tom Lane , Alena Rybakina , jian he , Nikolay Shaplov , pgsql-hackers@lists.postgresql.org, Robert Haas , pgsql-hackers@postgresql.org, Marcos Pegoraro , teodor@sigaev.ru, Peter Eisentraut , Ranier Vilela References: <567ED6CA.2040504@sigaev.ru> <65bfdcb6-0f0c-4d4c-a721-cb38a0ba91c7@postgrespro.ru> <670d1dc2-a280-4cf6-bc29-e2eafb107081@gmail.com> <93464dd6-d484-4021-b71f-e82928bf6758@gmail.com> <63617a30-6078-4e86-b44b-6364e04e210d@postgrespro.ru> <21752e9e-26fb-4665-bfcc-090bf4093e5a@postgrespro.ru> <9ac6480d-6686-4c3a-9149-ba66df4f88ad@gmail.com> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 10/4/24 03:15, Peter Geoghegan wrote: > On Tue, Oct 1, 2024 at 6:25 AM Alexander Korotkov wrote: >> I think this patchset got much better, and it could possible be >> committed after another round of cleanup and comment/docs improvement. >> It would be very kind if you share your view on the decisions made in >> this patchset. Let me provide a standpoint to help Alexander. The origin reason was - to avoid multiple BitmapOr, which has some effects at the planning stage (memory consumption, planning time) and execution (execution time growth). IndexScan also works better with a single array (especially a hashed one) than with a long list of clauses. Another reason is that by spending some time identifying common operator family and variable-side clause equality, we open a way for future cheap improvements like removing duplicated constants. Who knows, maybe we will be capable of using this code to improve cardinality estimations. According to your proposal, we have had such casting to the common type in previous versions. Here, we avoid it intentionally: the general idea is about long lists of constants, and such casting causes questions about performance. Do I want it in the core? Yes, I do! But may we implement it a bit later to have time to probe the general method and see how it flies? -- regards, Andrei Lepikhov