Question

Postgres: uuid or bigint ids for a small app?

Solved · 13 views · asked by ines_data · edited

Cursor defaults to uuid everywhere. My friend says bigint is faster and easier to read in logs.

What I’ve tried

Read three blog posts that disagree with each other, and asked Cursor, which just repeated the first one.

Comment

1 answer

Marked as helpful by the asker
olu_backend · edited

For an app your size it does not matter for performance. It matters for two other things:

  • URLs: uuids in URLs are ugly but unguessable; bigints are guessable (/orders/1042 → try 1041). If ids appear in URLs, uuid or a separate short id.
  • Merging data: uuids never collide across environments or imports.

Default: uuid primary key, plus a short readable id where humans see it. Exactly what this forum does, by the way.

Comment