From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Chris Withers <chris@withers.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: surprisingly slow creation of gist index used in exclude constraint
Date: Wed, 22 Dec 2021 16:21:16 +0100
Message-ID: <2efe68679dcc6c15bc956a6063b79e1e4018c006.camel@cybertec.at> (raw)
In-Reply-To: <967c5f24-a8ad-11fa-be3a-d2e10747e179@withers.org>
References: <789b3464-9bfc-2157-f4f4-71eb1da1050d@withers.org>
<967c5f24-a8ad-11fa-be3a-d2e10747e179@withers.org>
On Wed, 2021-12-22 at 09:58 +0000, Chris Withers wrote:
> A year and a half later, now that version 14 is the latest available,
> I wonder if anything has changed with respect to gist index creation?
> Probably also worth asking: are there now different index types this
> application should be using?
>
> > I'm upgrading a database from 9.4 to 11.5 by dumping from the old
> > cluster and loading into the new cluster.
> > The database is tiny: around 2.3G, but importing this table is proving problematic:
> >
> > Column | Type | Modifiers
> > ----------------+-------------------+----------------------------------------------------------
> > period | tsrange | not null
> > col1 | character varying | not null
> > col2 | character varying | not null
> > col3 | integer | not null
> > col4 | character varying | not null default ''::character varying
> > id | integer | not null default nextval('mkt_profile_id_seq'::regclass)
> > deleted | boolean | not null default false
> > managed | boolean | not null default false
> > col5 | character varying |
> > Indexes:
> > "mkt_profile_pkey" PRIMARY KEY, btree (id)
> > "mkt_profile_period_col1_col4_col2_chan_excl" EXCLUDE USING gist (period WITH &&, col1 WITH =, col4 WITH =, col2 WITH =, col3 WITH =)
> > Check constraints:
> > "mkt_profile_period_check" CHECK (period <> 'empty'::tsrange)
> > Foreign-key constraints:
> > "mkt_profile_col1_fkey" FOREIGN KEY (col1) REFERENCES host(name)
> >
> > It has 4.1 million rows in it and while importing the data only takes a couple of minutes,
> > when I did a test load into the new cluster, building the mkt_profile_period_col1_col4_col2_chan_excl
> > index for the exclude constraint took 15 hours.
You could use "pg_upgrade" for upgrading, that will be much faster.
Creating GiST indexes is still slow. You could test if any of the improvements
since v11 have made your case faster.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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: laurenz.albe@cybertec.at, chris@withers.org
Subject: Re: surprisingly slow creation of gist index used in exclude constraint
In-Reply-To: <2efe68679dcc6c15bc956a6063b79e1e4018c006.camel@cybertec.at>
References: <789b3464-9bfc-2157-f4f4-71eb1da1050d@withers.org> <967c5f24-a8ad-11fa-be3a-d2e10747e179@withers.org> <2efe68679dcc6c15bc956a6063b79e1e4018c006.camel@cybertec.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