pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Israel Brewster <ijbrewster@alaska.edu>
Cc: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: UUID or auto-increment
Date: Mon, 10 Aug 2020 13:16:29 -0400
Message-ID: <20200810171629.GW29590@tamriel.snowman.net> (raw)
In-Reply-To: <6A5ADFD3-AF87-4DFF-AA71-5AC31ED94A07@alaska.edu>
References: <CAHaowgVasGvbuEBW4Fh-4ke31A9YfAF=VO5yk0OwS+0TT+azrw@mail.gmail.com>
	<837516231.2607507.1597077490690@mail.yahoo.com>
	<2663a1f2-7377-58e7-ad7d-a867fe75cb15@gmail.com>
	<20200810165332.GV29590@tamriel.snowman.net>
	<6A5ADFD3-AF87-4DFF-AA71-5AC31ED94A07@alaska.edu>

Greetings,

* Israel Brewster (ijbrewster@alaska.edu) wrote:
> > On Aug 10, 2020, at 8:53 AM, Stephen Frost <sfrost@snowman.net> wrote:
> > * Ron (ronljohnsonjr@gmail.com) wrote:
> >> On 8/10/20 11:38 AM, Ravi Krishna wrote:
> >>> Finally UUID results in write amplication in wal logs.  Keep that in mind
> >>> if your app does lot of writes.
> >> 
> >> Because UUID is 32 bytes, while SERIAL is 4 bytes?
> > 
> > and because it's random and so will touch a lot more pages when you're
> > using it...
> 
> I would point out, however, that using a V1 UUID rather than a V4 can help with this as it is sequential, not random (based on MAC address and timestamp + random). There is a trade off, of course, as with V1 if two writes occur on the same computer at the exact same millisecond, there is a very very small chance of generating conflicting UUID’s (see https://www.sohamkamani.com/blog/2016/10/05/uuid1-vs-uuid4/ <https://www.sohamkamani.com/blog/2016/10/05/uuid1-vs-uuid4/;). As there is still a random component, however, this seems quite unlikely.

Sure, that helps, but it's still not great, and they're still much, much
larger than you'd ever need for an identifier inside of a given system,
so best to map it to something reasonable and avoid them as much as
possible.

Thanks,

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (13+ messages)  latest in thread

Message-ID: <20200810171629.GW29590@tamriel.snowman.net>
Permalink:  ../20200810171629.GW29590@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20200810171629.GW29590@tamriel.snowman.net

 · 

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: sfrost@snowman.net, ijbrewster@alaska.edu, ronljohnsonjr@gmail.com
  Subject: Re: UUID or auto-increment
  In-Reply-To: <20200810171629.GW29590@tamriel.snowman.net>
  References: <CAHaowgVasGvbuEBW4Fh-4ke31A9YfAF=VO5yk0OwS+0TT+azrw@mail.gmail.com> <837516231.2607507.1597077490690@mail.yahoo.com> <2663a1f2-7377-58e7-ad7d-a867fe75cb15@gmail.com> <20200810165332.GV29590@tamriel.snowman.net> <6A5ADFD3-AF87-4DFF-AA71-5AC31ED94A07@alaska.edu> <20200810171629.GW29590@tamriel.snowman.net>

* 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