pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mike Bayer <mike_mp@zzzcomputing.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Guidance on INSERT RETURNING order
Date: Wed, 12 Apr 2023 21:27:06 -0400
Message-ID: <86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com> (raw)
In-Reply-To: <84746f13-fc7f-9126-12f3-ae5fbd5e6b79@evolvis.org>
References: <CAN19dycS0oUorLOGgjxMX8NZq-hOA1RJrzwC4L3FxpMf4BQbBQ@mail.gmail.com>
	<95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com>
	<CAN19dyed0o5eCUYSEq30q39SpFmeZ7WSEHBfR042YYTVoipHcg@mail.gmail.com>
	<CACLU5mT5x-76uy_Rh821-WfnD3Z2iuMsZL4y1dsSBK2ypERcmA@mail.gmail.com>
	<c876553a-18f7-db6e-4972-76961f43a4ce@aklaver.com>
	<CACLU5mQYZY0ZwdTDUE6NTfn=7SbO_JJ5qhttED5xaqkps27kng@mail.gmail.com>
	<c422c4ef-a284-e45e-b968-27bff221e993@evolvis.org>
	<be108555-da2a-4abc-a46b-acbe8b55bd25@app.fastmail.com>
	<84746f13-fc7f-9126-12f3-ae5fbd5e6b79@evolvis.org>

We do something different for uuids.  These are usually created client side anyway or are very easy to create client side if not and then we also have a separate sentinel column option. 

Overall the whole thing is an optimization that can be turned off for uncommon cases.   We just can't go back to having insert of 1000 rows be 3-5x slower for all tables w server generated primary keys which is what statement at a time gets us.  Surrogate integer Pks w sequence or identity is the big case.

On Wed, Apr 12, 2023, at 8:58 PM, Thorsten Glaser wrote:
> On Wed, 12 Apr 2023, Mike Bayer wrote:
>
>>ascending values for "mytable_id_seq" will correspond to the ascending
>>values for "num".
>
> But, again, what if it’s uuid or something instead of a sequence?
>
> bye,
> //mirabilos
> -- 
> 15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)





view thread (56+ messages)  latest in thread

Message-ID: <86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com>
Permalink:  ../86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com/
Also on:    postgresql.org/message-id/86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com

 · 

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: mike_mp@zzzcomputing.com
  Subject: Re: Guidance on INSERT RETURNING order
  In-Reply-To: <86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com>
  References: <CAN19dycS0oUorLOGgjxMX8NZq-hOA1RJrzwC4L3FxpMf4BQbBQ@mail.gmail.com> <95fbd8c8-2f7a-38a1-4a41-b2ac3763d89c@aklaver.com> <CAN19dyed0o5eCUYSEq30q39SpFmeZ7WSEHBfR042YYTVoipHcg@mail.gmail.com> <CACLU5mT5x-76uy_Rh821-WfnD3Z2iuMsZL4y1dsSBK2ypERcmA@mail.gmail.com> <c876553a-18f7-db6e-4972-76961f43a4ce@aklaver.com> <CACLU5mQYZY0ZwdTDUE6NTfn=7SbO_JJ5qhttED5xaqkps27kng@mail.gmail.com> <c422c4ef-a284-e45e-b968-27bff221e993@evolvis.org> <be108555-da2a-4abc-a46b-acbe8b55bd25@app.fastmail.com> <84746f13-fc7f-9126-12f3-ae5fbd5e6b79@evolvis.org> <86f9eae7-acd6-45e7-b8a6-2a24b42fe306@app.fastmail.com>

* 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