Re: INSERT ... ON CONFLICT DO UPDATE - Mailing list pgsql-general

From Jeff Janes
Subject Re: INSERT ... ON CONFLICT DO UPDATE
Date
Msg-id CAMkU=1xENmH6ebqh5=O8w+kHyparkTVJH8eyZGBebojDGCQO=A@mail.gmail.com
Whole thread Raw
In response to Re: INSERT ... ON CONFLICT DO UPDATE  (Geoff Winkless <pgsqladmin@geoff.dj>)
List pgsql-general
On Mon, Jul 20, 2015 at 7:01 AM, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
On 20 July 2015 at 14:33, Rafal Pietrak <rafal@ztk-rp.eu> wrote:
If I'm not mistaken, the conclusions from posts in this thread are:

3. there are methods (like cryptographic "random" sequence), which
guarantee no conflicts. So one should resort to that.


Some web research suggests that random sequences are not great for indexes because of the resultant "keyspace fragmentation". I'm assuming that means a low number of nodes in the btree leafs, so an increase in memory usage for the index?

Just a thought.

If you are inserting random values into a very large btree index, you dirty at least one randomly-located block (the leaf page of the index) per inserted row.  This can cause some serious IO pain when that dirty data needs to be written out without the benefit of write-combining or sequential writes.

However, this is usually only a concern for bulk loading operations, not real time operations. If you are generating money-equivalent vouchers at a rate of thousands per second, hopefully you can afford some nice hardware to run it on.

Cheers,

Jeff

pgsql-general by date:

Previous
From: Igor Neyman
Date:
Subject: Re: INSERT ... ON CONFLICT DO UPDATE
Next
From: Francisco Olarte
Date:
Subject: Re: INSERT ... ON CONFLICT DO UPDATE