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.96) (envelope-from ) id 1vbk4J-00C2jh-1q for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Jan 2026 18:40:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vbk4H-00AhlU-21 for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Jan 2026 18:40:10 +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.96) (envelope-from ) id 1vbk4H-00AhlF-11 for pgsql-hackers@lists.postgresql.org; Fri, 02 Jan 2026 18:40:10 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vbk4F-0047bF-0p for pgsql-hackers@lists.postgresql.org; Fri, 02 Jan 2026 18:40:09 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-65d1bff2abaso6580311eaf.1 for ; Fri, 02 Jan 2026 10:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illuminatedcomputing-com.20230601.gappssmtp.com; s=20230601; t=1767379204; x=1767984004; 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=vuvZt/1D0LFrd4HdpVsnFkR9Pn8In4tP9GI0/W764r0=; b=qRKVeFxlkEdu9Aa2U/gJVyyilFzsVf3DddF6VboW84qfFHHpOSnHc6q7Z6tjBPDa0E QwY0XTpS3Z87YYWKg7Om/avR6jx8GRgnm0z5Lqrt8IUhkaZObJt5gE93DLZicmTpiWmP uYH6f0L2G/6IFNVmrxRinK0kNhD5hMLjuNkYIGjommbmhdcHQZUNzN/kF3FmzRv9zGdk ql23kppc3XTsLJtF2slsgr/p8ZpK0c8TzVi/uBiNuaxO44nV06XEzwXijKMQuOaNsxyi MhLPnRg2HnskfTHyECqTYIX1dZNhQBnycqtGzjDhzq3vhbMqbSP8AaZFny3ne08ZLV0b T0YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767379204; x=1767984004; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vuvZt/1D0LFrd4HdpVsnFkR9Pn8In4tP9GI0/W764r0=; b=ttKc95Zuq9V677FCVu9M/ZrQpbmqMzDa9vm1aOnOUzpn1LX33vlxGI/Fm6E/KErw9Y p9+bQL/Fae3Kd1hry1Cg+J2JIG0IgGlTkaGsGUDE0WmIDcXSrjxIDU1/53fa0zy480Nw hchP8aHKjy9Xkom9h7MJyG8Trxj1SFkd2BRWZ/Sy3V2kk+IaqMwWTIS3WQzqAJnY6Nof vIFidTj/m/NGeMaKIgb3mcNau11fyUYPtKfNb+2m7+WawAoCgvTDvmOsUThAdwAbg3Wn IF8mae1wV9NrxtLGVxbRiXuKn+8+SwNR1LWxZqFJxb8y2jUwM6dMQ0tdTefYokyE1A7x qB0g== X-Gm-Message-State: AOJu0YzWZF5627kI+PH1UUY+mfsxndO0YOADnrPDFbcbQhyTLPRetXa4 UmKftUDjscy4t6zAFeVoQKT1v+03O8zXnvoPtAuOsj3FaAm+wF4U4Y3jNaD5U82setl5+7wSGg/ 32a1FcrZBDJgVNaiL0KlYmvedKPAUVR6o7h9gjrIcrg== X-Gm-Gg: AY/fxX5+NPZeQcMaJQ9SIUTefR8Bp0lisD4J1kOB5PsDNrhOoRx/Fp7sFsVuhR1uzZt ZlbYatydm6Po5J6gdWVm2xvA7Ut1zPmjZ1qEaGT8+qx2WgV+yQCd2UiB9U5X86CjOqbYL1HDhKu s+E6DeLYr2A4MJHqPpGapj/oL3VY9ptiT6GH+nx3FlVJaoSrpY47yFMHXZAfmmuh82ffHHN10ET Wx3ExDfIGhXUoff0SIybmHNL2zBi+mVvW4k9S3/M6GgwLpyNzOwWZRYqlL51sXf7YMk X-Google-Smtp-Source: AGHT+IGswLSM3lNb2xwU+tXFrGTlAGFe4y8g9bJXJ9rVrSy3/ls9ZoxmKugp3glVoqM/q8l4S/qJMtEAbU4ua9T+/k0= X-Received: by 2002:a05:6820:8307:b0:65c:fe5b:9f5c with SMTP id 006d021491bc7-65d0eb6de1fmr11884208eaf.56.1767379204054; Fri, 02 Jan 2026 10:40:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Paul A Jungwirth Date: Fri, 2 Jan 2026 10:39:52 -0800 X-Gm-Features: AQt7F2p7shX-D1joTRCJhX9KB98Vcn9VNNHUVeTc6qhN49-TOf8uVXzImSeyYmc Message-ID: Subject: Re: Create unique GiST indexes To: Kirill Reshke Cc: PostgreSQL Hackers , Matthias van de Meent , Tom Lane , Laurenz Albe , n.bartek3762@gmail.com, Peter Eisentraut 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 Thu, Jan 1, 2026 at 11:17=E2=80=AFPM Kirill Reshke wrote: > > Hi! > I was also wondering about UNIQUE gist index desirability. Given > nearby WITHOUT OVERLAPS thread, looks like this is actually desirable. > > I will try to help move this thread forward. Thanks for taking a look! I noticed these emails were now going to *both* pgsql-hackers and pgsql-bugs (my fault), so I've removed pgsql-bugs from the CC list. Sorry about that! > The first issue I encounter, is following: > We have different behaviour for BTREE vs GIST for concurrent deletion. Li= ke: > > ``` > reshke=3D# create table t(i int); > CREATE TABLE > reshke=3D# create extension btree_gist ; > CREATE EXTENSION > reshke=3D# create unique index on t using gist(i); > CREATE INDEX > reshke=3D# insert into t values(1); > INSERT 0 1 > reshke=3D# insert into t values(2); > INSERT 0 1 > ``` > > now, do a concurrent delete and insert: > > > s1: BEGIN; DELETE FROM t; > > > s2: > reshke=3D# begin; > BEGIN > reshke=3D*# insert into t values(1); > ERROR: duplicate key value violates unique constraint "t_i_idx" > DETAIL: Key (i)=3D(1) already exists. > > With the UNIQUE GIST index we receive errors immediately, we are not > waiting for s1 to complete. If create BTREE index, s2 will wait until > s1 completes, and then commits/errors depending on s1 > commit/rollbacks. This is the missing MVCC functionality I mentioned when I posted the patch. It's the next thing on my list to work on. As I said the patch is not really done. But it took longer than I expected to send a reply to Matthias, and I wanted to post something before the commitfest deadline. And I thought I at least had enough to get feedback on the overall approach. I think your example here would make a great isolation test though. I'll incorporate that into future work, or please feel free to write it yourself and share if you like. Yours, --=20 Paul ~{:-) pj@illuminatedcomputing.com