The author explores whether queries from analytics benchmarks written on SQL-92 are irrelevant and inefficient in 2021, considering the window functions introduced in SQL:2003.
The original benchmark comparison between PostgreSQL and DuckDB was based on an execution time that exceeded one minute, caused by an inefficient SQL query.
Efficient SQL queries perform well with PostgreSQL-compatible databases, compared to inefficient ones.
The author writes an SQL query to address the business question, which uses standard SQL features established 29 years ago and implemented in all databases.
The author finds it easier to reason through each step and obtain accurate results using structured SQL queries with a WITH clause to define common table expressions.
The author recommends focusing on queries that avoid inefficient code to effectively compare performance with PostgreSQL-compatible databases.
PostgreSQL has prioritized simplicity in its code, which means it may perform poorly with poorly designed queries.
Indexing tables properly could further optimize query performance.
The author concludes that running benchmarks with queries that ignore the past 30 years of SQL is not recommended.