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 1quueR-0027YP-HW for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Oct 2023 13:07:23 +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 1quueO-009CAn-Q4 for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Oct 2023 13:07:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1quueO-009CAe-8o for pgsql-hackers@lists.postgresql.org; Mon, 23 Oct 2023 13:07:21 +0000 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1quueL-002FrB-Bn for pgsql-hackers@postgresql.org; Mon, 23 Oct 2023 13:07:19 +0000 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-5a7e5dc8573so32612837b3.0 for ; Mon, 23 Oct 2023 06:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1698066434; x=1698671234; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=13tWRTzqaRvfE35D/WpkjHntV+9PbBjM6hcjmIYa/28=; b=PVJN6dmIgroG+UfuIA14aCtCSwe4NbWpg8cB9sG/Kcs6Kq/CzehgL7skGoqywUFjVk bGnKUzUArq4UDmtyD9p+v2m0vqN54ZgoSIxRhKibkA5yPgz2a4tcYDLRmzp+PCArlNCi Nx3niys26cZcCymzNGM7nsfxts3kOOQU0BYsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698066434; x=1698671234; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=13tWRTzqaRvfE35D/WpkjHntV+9PbBjM6hcjmIYa/28=; b=DDv6zmuGaA8IngV3pe0bs2gfKZm0DpEdN7CQuJ87DoL8FYKdAwaJAxXzlf7bR/wdJ0 jN3xQJ/od7mWi4zc2Z0xo5sOl8ylL6QOrQZS3xSUYhxNszB9XXjVRSG+IgM3WtA5eTJY LhzrfzEUDqn1sF3NO8tbJIRQi/2NPXelb16kQ++zR6nOs0/diEe7hP6KtoaY+uw8zBKm aqjsfrT8iBEaNrwHS+kA3Y85plAOIs8syMjw6QlWtOKB7LSw2C56pqMDfbDO7Idc+0LC NAEhBn5dkVQPQXNPPsGUPr98cBH1vvl8TD4YHwKulvvJFKzyBAbiewqtOfw3MwGe43Xv JfDQ== X-Gm-Message-State: AOJu0YxiKn+HrvESiVQEDYoDB9J3wdwAOHF06qibsSoJ0aWY9jNitYLG K0rXgrirMvPoxi/Zs6ajVzfqhQ== X-Google-Smtp-Source: AGHT+IG1dwYbKo3BgY/xDItjiu4Q2iIc+UW3+Ket7fr2rm83Ibh98ZrfRfh9neERoXMxx/EHeCWgQA== X-Received: by 2002:a81:6d56:0:b0:5a8:1ff3:ef96 with SMTP id i83-20020a816d56000000b005a81ff3ef96mr9333750ywc.7.1698066434561; Mon, 23 Oct 2023 06:07:14 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id h3-20020a0dc503000000b005a4d922cf77sm3103100ywd.119.2023.10.23.06.07.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2023 06:07:13 -0700 (PDT) Date: Mon, 23 Oct 2023 06:07:10 -0700 From: Noah Misch To: Donghang Lin Cc: Peter Geoghegan , pgsql-hackers@postgresql.org Subject: Re: interval_ops shall stop using btequalimage (deduplication) Message-ID: <20231023130710.00.nmisch@google.com> References: <20231011013317.22.nmisch@google.com> <20231011032908.35@rfd.leadboat.com> <20231011183835.32@rfd.leadboat.com> <20231012231009.bf.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Oct 16, 2023 at 11:21:20PM -0700, Donghang Lin wrote: > > I've also caught btree posting lists where one TID refers to a '1d' heap > > tuple, while another TID refers to a '24h' heap tuple. amcheck complains. > Index-only scans can return the '1d' bits where the actual tuple had the > '24h' > bits. > > Have a build without the patch. I can't reproduce amcheck complaints in > release mode > where all these statements succeed. The queries I shared don't create the problematic structure, just an assertion failure. > > * Generic "equalimage" support function. > > * > > * B-Tree operator classes whose equality function could safely be > replaced by > > * datum_image_eq() in all cases can use this as their "equalimage" support > > * function. > It seems to me that as long as a data type has a deterministic sort but not > necessarily be equalimage, > it should be able to support deduplication. e.g for interval type, we add > a byte wise tie breaker > after '24h' and '1day' are compared equally. In the btree, '24h' and '1day' > are still adjacent, > '1day' is always sorted before '24h' in a btree page, can we do dedup for > each value > without problem? Yes. I'm not aware of correctness obstacles arising if one did that.