Re: Primary keys and composite unique keys(basic question)

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Primary keys and composite unique keys(basic question)
Date: 2021-04-06 02:53:03
Message-ID: CAHyXU0x6MJLC_bUo+83C59+3jLAbCDB5_qCK9SD2eHz=FHqrsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 5, 2021 at 9:37 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
> It's a small thing, but UUIDs are absolutely not memorizable by
> humans; they have zero semantic value. Sequential numeric identifiers
> are generally easier to transpose and the value gives some clues to
> its age (of course, in security contexts this can be a downside).
>
> I take the above as a definite plus. Spent too much of my life correcting others’ use of “remembered” id’s that just happened to perfectly match the wrong thing.
>
> Performance-wise, UUIDS are absolutely horrible for data at scale as
> Tom rightly points out. Everything is randomized, just awful. There
> are some alternate implementations of UUID that mitigate this but I've
> never seen them used in the wild in actual code.
>
>
> That b-tree’s have been optimized to handle serial ints might be a considered a reaction to that popular (and distasteful) choice. Perhaps there should be a ’non-optimized’ option.

It's not just the BTree, but the heap as well. For large tables, you
are pretty much guaranteed to read a page for each record you want to
load via the key regardless of the pattern of access. It's incredibly
wasteful regardless of the speed of the underlying storage fabric.
Very few developers actually understand this.

If computers were infinitely fast this wouldn't matter, but they aren't :-).

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mihalidesová Jana 2021-04-06 06:15:20 Upgrade from 11.3 to 13.1 failed with out of memory
Previous Message Rob Sargent 2021-04-06 02:37:09 Re: Primary keys and composite unique keys(basic question)