# The Performance Impact of SQL's FILTER Clause

DevFeed: [The Performance Impact of SQL's FILTER Clause](<https://devfeed.tech/articles/the-performance-impact-of-sql-s-filter-clause-28964.md>)

Original publisher: [Read original article](<https://blog.jooq.org/the-performance-impact-of-sqls-filter-clause/>)

Author: lukaseder

Published: 2023-02-06T07:51:38Z

Content type: article

Language: en

Sources: [jOOQ](<https://devfeed.tech/sources/jooq.md>)

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

Tags: [aggregate-functions](<https://devfeed.tech/tags/aggregate-functions.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [filter](<https://devfeed.tech/tags/filter.md>), [filter-clause](<https://devfeed.tech/tags/filter-clause.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [sql](<https://devfeed.tech/tags/sql.md>)

## AI overview

This article benchmarks SQL FILTER syntax against equivalent CASE expressions in PostgreSQL. On the author's machine, the benchmark found an 8% performance penalty for FILTER in the tested queries, while noting that results can vary with hardware and data sets.

## Source excerpt

I've found an interesting question on Twitter, recently. Is there any performance impact of using FILTER in SQL (PostgreSQL, specifically), or is it just syntax sugar for a CASE expression in an aggregate function? As a quick reminder, FILTER is an awesome standard SQL extension to filter out values before aggregating them in SQL. This ... Continue reading The Performance Impact of SQL's FILTER Clause ->