# aggregate

Published articles for aggregate.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Waiting for PostgreSQL 20 - Add min() and max() aggregate support for uuid.

DevFeed: [Waiting for PostgreSQL 20 - Add min() and max() aggregate support for uuid.](<https://devfeed.tech/articles/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid-33692.md>)

Original publisher: [Read original article](<https://www.depesz.com/2026/07/09/waiting-for-postgresql-20-add-min-and-max-aggregate-support-for-uuid/>)

Author: depesz

Published: 2026-07-09T12:41:14Z

Content type: article

Language: en

Sources: [select \* from depesz;](<https://devfeed.tech/sources/select-from-depesz.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [DateTime](<https://devfeed.tech/topics/datetime.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [btree](<https://devfeed.tech/tags/btree.md>), [max](<https://devfeed.tech/tags/max.md>), [min](<https://devfeed.tech/tags/min.md>), [order](<https://devfeed.tech/tags/order.md>), [pg20](<https://devfeed.tech/tags/pg20.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sort](<https://devfeed.tech/tags/sort.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>), [uuid](<https://devfeed.tech/tags/uuid.md>), [uuid-extract-timestamp](<https://devfeed.tech/tags/uuid-extract-timestamp.md>), [waiting](<https://devfeed.tech/tags/waiting.md>)

### AI overview

This article discusses a PostgreSQL patch adding min() and max() aggregate support for the uuid type. It explains that uuid is totally ordered through comparison operators and a btree operator class, and demonstrates the aggregates with UUID v7 and random UUIDs.

### Source excerpt

On 1st of July 2026, Masahiko Sawada committed patch: Add min() and max() aggregate support for uuid. The uuid type already has a full set of comparison operators and a btree operator class, so it is totally ordered. min() and max() were the only common aggregates missing for it. Add the uuid_larger() and uuid_smaller() ... Continue reading "Waiting for PostgreSQL 20 - Add min() and max() aggregate support for uuid."

## Understand GROUP BY in Django ORM with SQL

DevFeed: [Understand GROUP BY in Django ORM with SQL](<https://devfeed.tech/articles/understand-group-by-in-django-with-sql-33896.md>)

Original publisher: [Read original article](<https://hakibenita.com/django-group-by-sql>)

Author: Haki Benita

Published: 2020-02-10T22:00:00Z

Content type: tutorial

Language: en

Sources: [Haki Benita](<https://devfeed.tech/sources/haki-benita.md>)

Topics: [Django](<https://devfeed.tech/topics/django.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [articles](<https://devfeed.tech/tags/articles.md>), [count](<https://devfeed.tech/tags/count.md>), [django](<https://devfeed.tech/tags/django.md>), [filter](<https://devfeed.tech/tags/filter.md>), [orm](<https://devfeed.tech/tags/orm.md>), [sort](<https://devfeed.tech/tags/sort.md>), [sql](<https://devfeed.tech/tags/sql.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

### AI overview

A tutorial explains Django ORM aggregation by comparing QuerySets with equivalent SQL GROUP BY queries. It covers counting rows, handling NULL values, grouping by fields, filtering, sorting, and multiple aggregations.

### Source excerpt

Understand GROUP BY in Django ORM by comparing QuerySets and SQL side by side. If SQL is where you are most comfortable, this is the Django GROUP BY tutorial for you.

## The Mode Ordered-Set Aggregate Function

DevFeed: [The Mode Ordered-Set Aggregate Function](<https://devfeed.tech/articles/the-mode-ordered-set-aggregate-function-34570.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2017/11/the-mode-ordered-set-aggregate-function/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2017-11-13T17:15:51Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [aggregate-functions](<https://devfeed.tech/tags/aggregate-functions.md>), [analytics](<https://devfeed.tech/tags/analytics.md>), [cte](<https://devfeed.tech/tags/cte.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sort](<https://devfeed.tech/tags/sort.md>), [sql](<https://devfeed.tech/tags/sql.md>), [statistics](<https://devfeed.tech/tags/statistics.md>)

### AI overview

A tutorial explains how PostgreSQL's ordered-set aggregate function mode() WITHIN GROUP selects the most frequent genre for albums in the Chinook sample database, including ties and the use of a CTE.

### Source excerpt

In our article Exploring a Data Set in SQL we discovered a data set related to music: the Chinook sample database. Our discovery led us to find albums containing tracks of multiple genres, and for the analytics we were then pursuing, we wanted to clean the data set and assign a single genre per album. We did that in SQL of course, and didn't actually edit the data. Finding the most frequent input value in a group is a job for the mode() WITHIN GROUP (ORDER BY sort_expression) Ordered-Set Aggregate Function, as documented in the PostgreSQL page about Aggregate Functions.

## 10x: Logging at Clay.io

DevFeed: [10x: Logging at Clay.io](<https://devfeed.tech/articles/10x-logging-at-clay-io-35612.md>)

Original publisher: [Read original article](<https://zolmeister.com/2014/10/10x-logging-at-clay-io.html>)

Author: Zoli Kahan

Published: 2014-10-25T05:00:00Z

Content type: article

Language: en

Sources: [Zolmeister](<https://devfeed.tech/sources/zolmeister.md>)

Topics: [Logging](<https://devfeed.tech/topics/logging.md>), [log management](<https://devfeed.tech/topics/log-management.md>), [logstash](<https://devfeed.tech/topics/logstash.md>), [elasticsearch](<https://devfeed.tech/topics/elasticsearch.md>), [kibana](<https://devfeed.tech/topics/kibana.md>), [Amazon VPC](<https://devfeed.tech/topics/amazon-vpc.md>), [Server](<https://devfeed.tech/topics/server.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Docker](<https://devfeed.tech/topics/docker.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [amazon](<https://devfeed.tech/tags/amazon.md>), [amazon-vpc](<https://devfeed.tech/tags/amazon-vpc.md>), [analyze](<https://devfeed.tech/tags/analyze.md>), [apply](<https://devfeed.tech/tags/apply.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [complex](<https://devfeed.tech/tags/complex.md>), [docker](<https://devfeed.tech/tags/docker.md>), [elasticsearch](<https://devfeed.tech/tags/elasticsearch.md>), [kibana](<https://devfeed.tech/tags/kibana.md>), [linux](<https://devfeed.tech/tags/linux.md>), [logging](<https://devfeed.tech/tags/logging.md>), [logs](<https://devfeed.tech/tags/logs.md>), [logstash](<https://devfeed.tech/tags/logstash.md>), [network](<https://devfeed.tech/tags/network.md>), [series](<https://devfeed.tech/tags/series.md>), [server](<https://devfeed.tech/tags/server.md>), [servers](<https://devfeed.tech/tags/servers.md>), [ssh](<https://devfeed.tech/tags/ssh.md>)

### AI overview

This article describes how Clay.io used Logstash to aggregate logs from more than 20 servers, with Elasticsearch and Kibana for analysis. It also discusses log rotation, securing Elasticsearch through Amazon VPC, and open-sourced Docker containers for deploying a distributed logging system.

### Source excerpt

10x: Logging at Clay.io Managing 20+ servers as a small team is no easy task, and when things go wrong (they always do) figuring out what happened quickly is essential. Of course we can't ssh into each machine, that would take ages, so instead we use Logstash to aggregate our logs. This is the second post in my series, and if you missed last episode: Architecture at Clay.io. Logstash overview Logstash deployments have two parts. The aggregate server (or cluster), and the client servers.

## Aggregating NBA data, PostgreSQL vs MongoDB

DevFeed: [Aggregating NBA data, PostgreSQL vs MongoDB](<https://devfeed.tech/articles/aggregating-nba-data-postgresql-vs-mongodb-34534.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2014/02/aggregating-nba-data-postgresql-vs-mongodb/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2014-02-17T22:40:00Z

Content type: comparison

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [aggregation](<https://devfeed.tech/tags/aggregation.md>), [databases](<https://devfeed.tech/tags/databases.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sql](<https://devfeed.tech/tags/sql.md>)

### AI overview

This comparison loads NBA statistics from a BSON file into PostgreSQL, designs a normalized relational schema, and expresses a MongoDB aggregation query in SQL. It explains how PostgreSQL views, joins, filtering, grouping, ordering, and limiting can reproduce the referenced aggregation workflow.

### Source excerpt

When reading the article Crunching 30 Years of NBA Data with MongoDB Aggregation I coulnd't help but think that we've been enjoying aggregates in SQL for 3 or 4 decades already. When using PostgreSQL it's even easy to actually add your own aggregates given the SQL command create aggregate.

## Understanding Window Functions

DevFeed: [Understanding Window Functions](<https://devfeed.tech/articles/understanding-window-functions-34517.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2013/08/understanding-window-functions/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2013-08-20T10:04:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [SQL](<https://devfeed.tech/topics/sql.md>), [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [array-agg](<https://devfeed.tech/tags/array-agg.md>), [article](<https://devfeed.tech/tags/article.md>), [database](<https://devfeed.tech/tags/database.md>), [functions](<https://devfeed.tech/tags/functions.md>), [partitioning](<https://devfeed.tech/tags/partitioning.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [query](<https://devfeed.tech/tags/query.md>), [sql](<https://devfeed.tech/tags/sql.md>), [window-functions](<https://devfeed.tech/tags/window-functions.md>)

### AI overview

A tutorial explaining SQL window functions, including window frames, aggregate calculations, partitioning, and practical examples using PostgreSQL and motor racing data.

### Source excerpt

There was SQL before window functions and SQL after window functions: that's how powerful this tool is. Being that of a deal breaker unfortunately means that it can be quite hard to grasp the feature. This article aims at making it crystal clear so that you can begin using it today and are able to reason about it and recognize cases where you want to be using window functions. *We see a part of the data as if through a little window*

## Using array\_agg in Postgres - powerful and flexible

DevFeed: [Using array\_agg in Postgres - powerful and flexible](<https://devfeed.tech/articles/using-array-agg-in-postgres-powerful-and-flexible-41134.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2013/04/17/Using-array_agg-in-Postgres-powerful-and-flexible/>)

Author: Map

Published: 2013-04-17T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [PostgreSQL](<https://devfeed.tech/topics/postgresql.md>), [Query (disambiguation)](<https://devfeed.tech/topics/query.md>), [function](<https://devfeed.tech/topics/function.md>)

Tags: [aggregate](<https://devfeed.tech/tags/aggregate.md>), [array](<https://devfeed.tech/tags/array.md>), [array-agg](<https://devfeed.tech/tags/array-agg.md>), [email](<https://devfeed.tech/tags/email.md>), [functions](<https://devfeed.tech/tags/functions.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [query](<https://devfeed.tech/tags/query.md>)

### AI overview

This tutorial explains how to use PostgreSQL arrays and the array_agg function to aggregate project and task data into formatted results, reducing the need to group query results in application code. It demonstrates the approach with a project-management email example.

### Source excerpt

In almost any application it's common to want to aggregate some set of values together, commonly in a comma separated form. Most developers do this by running a query to get much of the raw data, looping over the data and pushing it into a set, appending each new value to the appropriate key. Hopefully, it's not a surprise that there's a much better way to do this with PostgreSQL. Postgres has a flexible and robust array datatype that comes with a variety of functions. Even without taking advantage of the array datatype in your application, you can still take advantage of some of the functions to get the functionality you need. Lets take a look at an example schema and use case. An example Given a project management application, you may have users who have projects that have tasks. An example piece of functionality might be to send an email with a list of all projects that have tasks that are past their due dates of completion. Your schema might look something like this: # \d users Table "public.users" Column | Type | Modifiers ------------+-----------------------------+----------- id | integer | not null email | character varying(255) | ... # \d projects Table "public.projects" Column | Type | Modifiers ------------+-----------------------------+----------- id | integer | not null user_id | integer | not null name | character varying(255) | not null ... # \d tasks Table "public.tasks" Column | Type | Modifiers --------------+-----------------------------+----------- id | integer | not null project_id | integer | not null completed_at | timestamp without time zone | due_at | timestamp without time zone | ... To get a list of all projects that have tasks that haven't been completed, you would start with something like: SELECT projects.name FROM projects, tasks WHERE projects.id = tasks.project_id AND tasks.due_at > tasks.completed_at AND tasks.due_at > now() This would give you a list of projects which you could then easily join this with users: SELECT users.email pr