pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: index unique
Date: Tue, 8 Jun 2021 20:42:12 +0200
Message-ID: <20210608184212.GA9580@hjp.at> (raw)
In-Reply-To: <CADX_1aZEC0+AhHyWW=9C251F4DTxoWnENktqVP17h_=JXC5-5A@mail.gmail.com>
References: <CADX_1aYbmMHK4wqHd=p_fGsNMOgEB7oe0BY_9ZTWv3e-TQx+oA@mail.gmail.com>
	<20210607065501.GA17125@hjp.at>
	<CAKFQuwbBZQTLtYRxaJUfGFGj60vmcEYCsxiw3tAj1U12kR3TiA@mail.gmail.com>
	<20210607220848.GB17125@hjp.at>
	<CADX_1aZEC0+AhHyWW=9C251F4DTxoWnENktqVP17h_=JXC5-5A@mail.gmail.com>

On 2021-06-08 18:30:16 +0200, Marc Millas wrote:
> the only pb observed is the size of the object accepted. if the geom is a bit
> "big" then the index errors.about btree size of index object.
> but if I create a table test_l with a text column blabla as a PK, and insert a
> 100 000 character long string , no pb.
> if I do an explain analyze select blabla from test_l order by blabla, postgres
> tells me that it did an index only scan.
> so, I wonder why Postgres is able to put a 100 000 long text in a btree index
> and NOT a geom column which wkt is 10 000 bytes long.

Good question. Maybe your texts compresses better than your geometries:

hjp=> insert into t(t) values(repeat('a', 235327) || '1');
INSERT 0 1
Time: 60.057 ms
hjp=> insert into t(t) values(repeat('a', 235328) || '1');
ERROR:  index row size 2720 exceeds maximum 2712 for index "t_pkey1"
HINT:  Values 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.
Time: 58.751 ms

Note the difference between the length of the string I was trying to
insert and the length of the row it complains about.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (16+ messages)  latest in thread

Message-ID: <20210608184212.GA9580@hjp.at>
Permalink:  ../20210608184212.GA9580@hjp.at/
Also on:    postgresql.org/message-id/20210608184212.GA9580@hjp.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: index unique
  In-Reply-To: <20210608184212.GA9580@hjp.at>
  References: <CADX_1aYbmMHK4wqHd=p_fGsNMOgEB7oe0BY_9ZTWv3e-TQx+oA@mail.gmail.com> <20210607065501.GA17125@hjp.at> <CAKFQuwbBZQTLtYRxaJUfGFGj60vmcEYCsxiw3tAj1U12kR3TiA@mail.gmail.com> <20210607220848.GB17125@hjp.at> <CADX_1aZEC0+AhHyWW=9C251F4DTxoWnENktqVP17h_=JXC5-5A@mail.gmail.com> <20210608184212.GA9580@hjp.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox