Re: UUID or auto-increment

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: UUID or auto-increment
Date: 2020-08-10 20:56:37
Message-ID: aa7b6e3d-2892-090a-99cb-61d4c29f7304@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/10/20 10:53 AM, Stephen Frost wrote:
> Greeitngs,
>
> * Ron (ronljohnsonjr(at)gmail(dot)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...
>
> Avoid UUIDs if you can- map them to something more sensible internally
> if you have to deal with them.
>
> Thanks,
>
> Stephen
>
I suspect the increased storage cost is more related to the size of the
record than to the ratio of the data types.

What says two consecutively saved records ought to be stored on the same
page or will likely be sought with the same search criterion. Serial
ids put a time order (loosely) on the data which may be completely
artificial.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John W Higgins 2020-08-10 21:30:48 Re: UUID or auto-increment
Previous Message Israel Brewster 2020-08-10 20:44:49 Re: UUID or auto-increment