Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Peter Geoghegan <pg(at)heroku(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Date: 2014-09-26 12:58:17
Message-ID: 542562E9.9080804@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/26/2014 03:40 PM, Andres Freund wrote:
> On 2014-09-26 15:32:35 +0300, Heikki Linnakangas wrote:
>> On 09/26/2014 03:30 PM, Andres Freund wrote:
>>> On 2014-09-26 15:24:21 +0300, Heikki Linnakangas wrote:
>>>> I don't know what you mean by "in the head of AM", but IMO it would be far
>>>> better if we can implement this outside the index AMs. Then it will work
>>>> with any index AM.
>>>
>>> Also, it's the only chance to make this ever work across partitions.
>>
>> How so? Assuming there's no overlap in the partitions, you could lock the
>> page in the index of the partition you're inserting to, just like you would
>> insert the promise tuple to the right partition.
>
> Well, the 'no overlap' case is boring.

Ok.

> At least if you mean that each partition has disctinct value ranges
> in the index?

Right.

> And the reason that the buffer locking approach in the overlapping case
> is that you'd need to hold a large number of pages locked at the same
> time. Right?

Yeah, you would. To be honest, I didn't even think about the overlapping
case, I just assumed that the overlapping case is the typical one and
only thought about that.

> But primarily I mean that bulk of the uniqueness checking logic has to
> live outside the individual AMs. It doesn't sound enticing to reach from
> inside one AM into another partitions index to do stuff.

Yeah, that's a non-starter. Even with the index locking stuff, though,
it wouldn't be the AM's responsibility to reach out to other partitions.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-09-26 13:34:19 Re: Scaling shared buffer eviction
Previous Message Oskari Saarenmaa 2014-09-26 12:55:52 Re: Inefficient barriers on solaris with sun cc