Re: UUID vs. Sequential ID as Primary

From: Peter Gram <peter.m.gram_at_gmail.com>
Date: Thu, 11 Apr 2024 09:10:36 -0500
Message-ID: <CAJ=80GX+dK=CsYdDafiDgQW44n-Y6xj515BFgxc+WkC6wd=gBA_at_mail.gmail.com>



Hi

If you use the returning clause on the first statement you don’t get a extra round trip to the database to get the sequence.

Med venlig hilsen

Peter Gram
Sæbyholmsvej 18
2500 Valby

Mobile: (+45) 5374 7107
Email: peter.m.gram_at_gmail.com

On Wed, 10 Apr 2024 at 23.38, ahmed.fikri_at_t-online.de < ahmed.fikri_at_t-online.de> wrote:

> Hi there,
>
>
>
> Once more, a question about fundamentals:
>
>
>
> In several Hibernate projects, I've observed developers leaning towards
> using UUIDs as primary keys instead of numerical values. This preference
> likely stems from the avoidance of sequences for numerical primary keys,
> which necessitate round trips to the database after each insertion.
> Additionally, there's a concern about potential contention with sequences,
> and some developers may prefer to avoid predictability in the next
> generated value. Personally, I remain skeptical about the widespread use of
> UUIDs due to their larger storage footprint (both in tables and indexes)
> compared to numerical IDs. Numeric IDs also offer benefits in issue
> analysis. However, it's worth noting that Hibernate employs algorithms to
> minimize round trips to the database, effectively reducing their impact.
> Could you please share your experience and preference? What choice would
> you make?
>
>
>
> Regards
>
> Ahmed
> 
>

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Apr 11 2024 - 16:10:36 CEST

Original text of this message