From: Andres Freund <andres@anarazel.de>
To: Paul Hester <paul@salesintel.com>
Cc: Peter Geoghegan <pg@heroku.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts
Date: Wed, 6 Jan 2016 19:19:46 +0100
Message-ID: <20160106181946.GE7650@awork2.anarazel.de> (raw)
In-Reply-To: <CAOwSVr_9FARiegvC54VqZiTz9A3ryuaAbi8XHYha+y=NHmeQpw@mail.gmail.com>
References: <20160105150227.1117.51692@wrigleys.postgresql.org>
<20160105161326.GD7650@awork2.anarazel.de>
<CAM3SWZS2jd1Ci2TR2bjBXqZgK3JdoFin9yGbC5TQdYdF12RBuA@mail.gmail.com>
<CAOwSVr_9FARiegvC54VqZiTz9A3ryuaAbi8XHYha+y=NHmeQpw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 2016-01-05 22:04:41 -0700, Paul Hester wrote:
> No peek-ahead necessary, when the sequenced column would not be used in the
> conflict_target. UPSERTS to dimension tables in a star schema as part of an
> OLAP system are very handy, but typically the records in the dimension
> tables use a surrogate key based on sequences for maintenance & performance
> reasons, and the 'natural' key/value is the only column that would be used
> to detect a conflict. In this case, the 'normal' path would be the
> conflict_action nearly all the time, and not the insert. If the typical
> path was the INSERT, I'd bet the data would be from some event source, and
> I guess in that case if there were a key column defaulted with a sequence,
> like an order#, it would have to be used to resolve conflicts. But it's
> hard to imagine a case in a process flow where you wouldn't already know if
> the event existed or not, limiting the need for an UPSERT on event data.
It'd be very fragile. You could only do that if the value isn't involved
in any unique indexes, if there are no BEFORE triggers (since they need
to see the value).
> This limitation, of consuming sequencers used for defaults on columns not
> necessary to resolve conflict, diminishes the viability for using Postges
> UPSERTS for large data warehouses, is all I'm saying (or requires surrogate
> keys being 64 bit). Just caught me by surprise in comparison to other
> RDBMSs offering some form of UPSERTs that would not consume a sequencer if
> its values weren't required to resolve conflicts.
If you use normal sequences you already need to cope with gaps in
sequences. And ids needing to be 64bits if you're a longer lived
business and it's for a a halfway "popular" table, isn't something new.
So I don't think addressing this is worth adding code for, especially
given the fragility of the situations where it'd be usable.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: andres@anarazel.de, paul@salesintel.com, pg@heroku.com
Subject: Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts
In-Reply-To: <20160106181946.GE7650@awork2.anarazel.de>
References: <20160105150227.1117.51692@wrigleys.postgresql.org> <20160105161326.GD7650@awork2.anarazel.de> <CAM3SWZS2jd1Ci2TR2bjBXqZgK3JdoFin9yGbC5TQdYdF12RBuA@mail.gmail.com> <CAOwSVr_9FARiegvC54VqZiTz9A3ryuaAbi8XHYha+y=NHmeQpw@mail.gmail.com> <20160106181946.GE7650@awork2.anarazel.de>
* 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