Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5BJM-0007Ym-Ak for pgsql-general@arkaria.postgresql.org; Mon, 10 Aug 2020 17:10:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k5BJL-0002WK-8k for pgsql-general@arkaria.postgresql.org; Mon, 10 Aug 2020 17:10:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5BJK-0002W0-Ap for pgsql-general@lists.postgresql.org; Mon, 10 Aug 2020 17:10:11 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k5BJF-0004VH-7h for pgsql-general@lists.postgresql.org; Mon, 10 Aug 2020 17:10:09 +0000 Received: by mail-pg1-x530.google.com with SMTP id j21so5250790pgi.9 for ; Mon, 10 Aug 2020 10:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alaska.edu; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=2wWPlO9S3OjwFyQW4IWPtrHOniawMb+XL6vl//qjjss=; b=TPkMc4Eo0MPIX8nC/3yOValQRPxbZU91/RvuXpWg0WiyZSXLbZeqmwuAKFHGwYgcgc Cq7p79RPvm5CK4+ZgutCgGwf/s2yNlD20dFZ1WX3IepRtSncPwdCr5aEOWkEbFO7rjca yYS9GnulhCjjnEDXSx9cU75Gh2lic4Cj9ITqPwBzGuikwYFCeXOHg5rYriq/zFZCip2t jiyex4B6QfhJ4MalLOfu725+fxAVU6bKmzM0TT+GJXT6nRPjKymSw3ZJw9ZMbdmseGjh i2nzgaRn/Uz9DbR+frMgqsowOJU4GyYeWEYC704nYYZSv9CV+YWmts7Wo31M3MwTJasH oGAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=2wWPlO9S3OjwFyQW4IWPtrHOniawMb+XL6vl//qjjss=; b=KtkpcwQSwh5EpYTF9EUGrvvV8ps06johoDR5wOuI+//ET0o9V3pac3FJ/apzbkuUz+ 9LDm8o8fbqQYzJYre5l86LqGJzR7dzTgTtyhbx9x4f9CP1winqxV9KI5/LCWLD8Pma6l 3f8FwMvFCUJq93goUmn9bN+564HgDfYjpyiuynFMGTG8960F5aArZCuRe96W+hzFgOR7 hPpnwsIWzPFiw3Cy/iXqJmyxPjQTbmfzVukn8uBRHGovsQ4kKlzWbjiMIETQyNsA+8+X nSywOF+krVzbw8VZCsqsZ3eVcafySqolhu2Q/jdoIC7MYCNEFfSZkrynXiNxcynp2s1E hf3g== X-Gm-Message-State: AOAM530jbqV/D6OwKLbrwpU7hzua1+rjKasYzbqsCxz1v5lOfN++lZ42 SlA39N3ql0nq6Pna5S26DmCn+w== X-Google-Smtp-Source: ABdhPJy+sQQhv4ZNvNqjnas7hLHkFkByFajAUGhQGLAjgM4r4q4Ej3xdW32G3CRjZhvQ/pMxGdnMag== X-Received: by 2002:a63:6e4f:: with SMTP id j76mr22030125pgc.449.1597079402959; Mon, 10 Aug 2020 10:10:02 -0700 (PDT) Received: from [10.27.81.2] (71-80-178-69.gci.net. [69.178.80.71]) by smtp.gmail.com with ESMTPSA id bt10sm110166pjb.39.2020.08.10.10.10.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2020 10:10:02 -0700 (PDT) From: Israel Brewster Message-Id: <6A5ADFD3-AF87-4DFF-AA71-5AC31ED94A07@alaska.edu> Content-Type: multipart/alternative; boundary="Apple-Mail=_7F36EFE4-51D3-4B8C-AA4C-D84CCAA6FDC0" Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: UUID or auto-increment Date: Mon, 10 Aug 2020 09:10:00 -0800 In-Reply-To: <20200810165332.GV29590@tamriel.snowman.net> Cc: Ron , pgsql-general@lists.postgresql.org To: Stephen Frost References: <837516231.2607507.1597077490690@mail.yahoo.com> <2663a1f2-7377-58e7-ad7d-a867fe75cb15@gmail.com> <20200810165332.GV29590@tamriel.snowman.net> X-Mailer: Apple Mail (2.3608.120.23.2.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_7F36EFE4-51D3-4B8C-AA4C-D84CCAA6FDC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 --- Israel Brewster Software Engineer Alaska Volcano Observatory=20 Geophysical Institute - UAF=20 2156 Koyukuk Drive=20 Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145 > On Aug 10, 2020, at 8:53 AM, Stephen Frost wrote: >=20 > Greeitngs, >=20 > * 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. >>=20 >> Because UUID is 32 bytes, while SERIAL is 4 bytes? >=20 > 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=E2=80=99s = (see https://www.sohamkamani.com/blog/2016/10/05/uuid1-vs-uuid4/ = ). As there = is still a random component, however, this seems quite unlikely. >=20 > Avoid UUIDs if you can- map them to something more sensible internally > if you have to deal with them. >=20 > Thanks, >=20 > Stephen --Apple-Mail=_7F36EFE4-51D3-4B8C-AA4C-D84CCAA6FDC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
---
Israel Brewster
Software = Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk = Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell: =  907-328-9145

On Aug 10, 2020, at 8:53 AM, Stephen Frost <sfrost@snowman.net> = wrote:

Greeitngs,

* 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=E2=80=99s = (see https://www.sohamkamani.com/blog/2016/10/05/uuid1-vs-uuid4/= ). As there is still a random component, however, this seems quite = unlikely.



Avoid UUIDs if you can- map them to something more sensible = internally
if you have to deal with them.

Thanks,

Stephen

= --Apple-Mail=_7F36EFE4-51D3-4B8C-AA4C-D84CCAA6FDC0--