<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s" -->

---
title: Waiting for PostgreSQL 20 – Add min() and max()...
description: PostgreSQL 20 adds min() and max() aggregate functions for the uuid type. Since uuid already has a full set of comparison operators and a btree operator class,...
canonical: https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid. – select * from depesz; | daily.dev
og:description: PostgreSQL 20 adds min() and max() aggregate functions for the uuid type. Since uuid already has a full set of comparison operators and a btree operator class,...
og:url: https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s
og:image: https://api.daily.dev/og/posts/ZwdJdSv2S.png
og:image:alt: Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid. – select * from depesz;
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid. – select * from depesz;

**[depesz](https://daily.dev/sources/depesz)** · 3 min read · 4 upvotes · 0 comments

## Summary

PostgreSQL 20 adds min() and max() aggregate functions for the uuid type. Since uuid already has a full set of comparison operators and a btree operator class, the patch simply adds uuid_larger() and uuid_smaller() support functions and registers the aggregates. UUIDs are compared lexicographically over their 128 bits. For UUIDv7, whose most significant bits encode a Unix timestamp, this means min() and max() correspond to the oldest and newest values respectively. The post demonstrates the feature with both UUIDv7 (timestamp-based) and random UUIDs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.depesz.com/2026/07/09/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid>

## Similar posts on daily.dev

- [Waiting for PostgreSQL 19 – Add date and timestamp variants of random\(min, max\). – select \* from depesz;](https://daily.dev/posts/waiting-for-postgresql-19-add-date-and-timestamp-variants-of-random-min-max-select-from-dep-h70nboxzx) · depesz · 20 upvotes · 1 comments
- [The Time Traveler's Primary Key](https://daily.dev/posts/the-time-traveler-s-primary-key-x5yvsdpzm) · Planet PostgreSQL · 0 upvotes · 0 comments

---

Tags: [#sql](https://daily.dev/tags/sql), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid. – select * from depesz;","url":"https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s"},"datePublished":"2026-07-09T12:41:54.575Z","dateModified":"2026-07-09T12:42:14.519Z","description":"PostgreSQL 20 adds min() and max() aggregate functions for the uuid type. Since uuid already has a full set of comparison operators and a btree operator class,...","image":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","thumbnailUrl":"https://media.daily.dev/image/upload/s--1KxV4ohY--/f_auto/v1722860400/public/Placeholder%2007","isAccessibleForFree":true,"articleSection":"depesz","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"depesz","logo":"https://media.daily.dev/image/upload/s--ir7juGOi--/f_auto/v1758461024/logos/depesz","url":"https://daily.dev/sources/depesz"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-select-from-depesz--zwdjdsv2s","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"sql,postgresql","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"depesz","item":"https://daily.dev/sources/depesz"},{"@type":"ListItem","position":3,"name":"Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid. – select * from depesz;"}]}
```

