← Back to list

Sorting Out Collations in PostgreSQL: Implementation, Upgrades, Survival Strategies

Josef Machytka: Speaker portfolio

Josef Machytka · 2025-11-20 12:36 · 9 claps · 0.9 min read
#postgresql #collation #database-collation #libc #icu
Open on Medium ↗
Wiki topics: INV · Investing & Markets

Sorting Out Collations in PostgreSQL: Implementation, Upgrades, Survival Strategies

*Josef Machytka: Speaker portfolio*

A collation defines how a database orders and compares strings. Postgres does not implement its own string‑ordering rules; instead it delegates to external libraries — the operating system’s C library (libc) or the International Components for Unicode (ICU). Collations influence ordering in ORDER BY, B‑tree indexes, unique constraints, partition boundaries and even pattern matching. If the underlying library changes its collation rules (e.g., after a glibc or ICU upgrade), the cached ordering stored in indexes may become inconsistent, leading to wrong query results. This talk summarizes all relevant information about this problem from latest articles and conferences talks and shows how to deal with this issue. It also dives into PostgreSQL code explaining collations implementation details.

Key takeaways

  • Collations are defined in Unicode Common Locale Data Repository (CLDR)
  • Collations determine ordering — they are external to Postgres and implemented by libc or ICU
  • Changing the underlying library changes how strings are sorted and compared
  • New build-in collation introduced in PostgreSQL 17 do not solve language related issues

Presented at & Slides

Recording

[embed]

Image created by DeepDreamGenerator

Image created by DeepDreamGenerator


메타데이터
post_id
bf1cdcdb79a6
slug
sorting-out-collations-in-postgresql-implementation-upgrades-survival-strategies-bf1cdcdb79a6
url
https://medium.com/@josef.machytka/sorting-out-collations-in-postgresql-implementation-upgrades-survival-strategies-bf1cdcdb79a6
canonical_url
https://medium.com/@josef.machytka/sorting-out-collations-in-postgresql-implementation-upgrades-survival-strategies-bf1cdcdb79a6
author_url
https://medium.com/@josef.machytka
status
ok
fetched_at
2026-06-25 07:00:49