Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqigZ-0004A9-5l for pgsql-general@arkaria.postgresql.org; Tue, 08 Jun 2021 20:50:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqigY-0005aG-2x for pgsql-general@arkaria.postgresql.org; Tue, 08 Jun 2021 20:50:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqigX-0005a7-PL for pgsql-general@lists.postgresql.org; Tue, 08 Jun 2021 20:50:53 +0000 Received: from mout.gmx.net ([212.227.17.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqigV-0008Vo-Ta for pgsql-general@lists.postgresql.org; Tue, 08 Jun 2021 20:50:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1623185450; bh=NFZFSh9ub9PXh2O/ybGkMc853/4uy5ym0knhIWlPkxw=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=fFDODRaehQGJpSC3mqZNkqIyHH9xW/eMftvH2dTbakE/GXuMQIydWNAFHChlBTDco t/YgFAsiANhwSSEH5J0JzixXB5+qJZ7EFdo/VAbrH39+tjooPjEAkmQfNrFZbs6Jet grr+2DlBXE8gq6+jsJi/9Ffh8biAhbIJYSHPs6ws= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.20] ([83.171.174.250]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M6lpG-1liS1M0QqU-008G8p for ; Tue, 08 Jun 2021 22:50:50 +0200 Subject: Re: index unique To: pgsql-general@lists.postgresql.org References: From: Thomas Kellerer Message-ID: <99cf7fa9-9788-c576-cb49-3aec780168f6@gmx.net> Date: Tue, 8 Jun 2021 22:50:48 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:zl7EdIQL8wZ6PL4BZuJGo0ApzKq61fTeZy1dTpvqgF0jWr2RYP0 QIX74zbr7rqa1Bsw0UhNe8InmuQgfCbLEkPEfCZPuuIuSd4Asfnwh3B4Fm7px0bfAZRMQdx 9zckdLdXQZsutFYqwovf9KdvJ2MO3j62wz+YcFHngKPEckonvEnu2DD+Fdh7/mP4PjRFdFa vKObbQ/jQoHefWip9sJbQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:R5nMghD1E78=:aoz3kjfjyQlzf0Zi5tONf1 38PjrXjUNJ4xayDFidEu+F6fkxz8IFRTG5nTRjBWNj+PodCSuNkFb08MpkGYx/yFCbexMGcJ7 DKjd8+7fjPHgORZyYY48WXIn1ljDt+1m6qIKFacovNONbH8sdsLa3j2pHrq2l6ACVDg4sC2/R rIJs82Ge7XHDe1i1z6lagiGQqBL9zLHpkxejPFxGVNeo5XiJYcbRyXK2UsCNDp4KWh2OmauZz 6LzOd8A9WS/i++J1BJflVFaHIQtnWIxNt3Id8qQMkdKx/bVb55q0fIEbz2zygPhX9iCLz15Bz mn9dYV2lrLO5zCuTa7M3FVd4eDfz+m3zPSgdYbf1LS9AxkZa6YqleLcUQJjQXyt0q6a+EQtYG 0g4/zdBc2pd9XuQ8VeK6LEODZb3hCCbtuajiT7GLU2NoxZeapg7RbKdK9RLhh87sjk+Jv3p+C vxf7K8tW8U8RnTpdc/BtikRVA8DeDCML6ZNzvz1oMutImnPP9tQn0xAAH4vcFdZAlfOB9HSAV s/AX0s/Us4QkvvTen2OBzQkpYN//fpSSpIrISElUo8puschgQpNqxo9xGjaW4TQM0xKbwWeBI DWwWSzZfsNvRURHRzS4bpfozK2aF0Okv5Td5+hLtJWvwlMg4S9/GUSVG2dDUOOc91UOR/bJRE aEvyNhjWfFKxhVGO0zGCjJ0Jr2OjNeh7QOEWaEiKwQOKembQ4jhJXnwxicdL4z/nTBft7lqwk Y4dDneAbd9Q9HwJm3Emyi3s79ubLTl8820ESgQvUTafvbCgdY+B0wr4Z7sgb5hurPIgWod1x6 WYyeYwmPm6OAdjSEfM9kf4M8sB4ck1y4k5sklsN7Ch1bBIcfcBHQXNB2gFDWkFRj/XO8ss4An zKwcKER3VI40Wz1yLTPfiPMQNx+bGihoRjqIbM8hxcwS53FvTaU3RmmJzavmttfC3+XCCdfJC ytaGlYH0h7NTORtsy0t2MiFCtHHv6LN04crKTajMEk2Ts72eoAftAc57iPvsg6Fi9nfjnCtxs 4GQinJE7EHC+0knzlHHWaSwFDJ8FUyaYTUq5HBmmGq4ozGgBIC8Ah/TrBnzKo/VxHLYdrGw6O UvKLtYXQ9mksepeXGthdBzkVAhbFoMzpX1Y List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Marc Millas schrieb am 03.06.2021 um 22:51: > on a table we need a primary key and to get a unique combinaison, we nee= d 3 columns of that table: > 1 of type integer, > 1 of type text, > 1 of type geometry > > creating the PK constraint doesn work: (even with our current small data= set) > ERROR: =C2=A0index row size 6072 exceeds btree version 4 maximum 2704 fo= r index "xxx_spkey" > DETAIL: =C2=A0Index row references tuple (32,1) in relation "xxx". > HINT: =C2=A0Values larger than 1/3 of a buffer page cannot be indexed. > Consider a function index of an MD5 hash of the value, or use full text = indexing. > > ok. we can do this. > but if so, we need to create a gist index on the geometry column to do a= ny topology request. > so 2 indexes containing this single column. > > if we install extension btree_gist, no pb to create an index on all 3 co= lumns. > but as gist does not=C2=A0support unicity, this index cannot be used for= the PK. > > OK, we may try to use a function to get the bounding box around the geom= etry objects and use the=C2=A0result into a btree index........ > > Any idea (I mean: another idea !) to tackle this ? > Or any critic on the "solution" ?? How do you define the "uniqueness" of the geometry? GIST can support "uniqueness" through exclusion constraints. It's not a primary key, so you can't create foreign keys referencing that = table, but it does ensure uniqueness (In fact the "normal" unique indexes are essentially a special case of exclusion constraints) create index on the_table using gist (int_column with =3D, text_col wi= th =3D, geometry_col with &&); Replace the && operator with whatever is appropriate for your use case. Thomas