Find the article on our blog here:
https://pganalyze.com/blog/5mins-post...
In E120 of "5mins of Postgres" we return to our Postgres planner quirks series to talk about Incremental Sort, and when it goes wrong. Incremental Sort can often speed up query plans when you have an existing sort order; however, there can be edge cases where the planner chooses a sub-optimal plan.
Learn more about pganalyze:
https://pganalyze.com
https://pganalyze.com/newsletter
/ pganalyze
Check out the pganalyze library for eBooks, webinars, and more:
https://pganalyze.com/resources
📑 What we have discussed in this episode of 5mins of Postgres:
"Implement Incremental Sort" commit by Tomas Vondra in Postgres 13
https://git.postgresql.org/gitweb/?p=...
"Incremental Sort" node in EXPLAIN output
https://pganalyze.com/docs/explain/ot...
5mins of Postgres - Faster query plans with Postgres 16: Incremental Sorts, Anti-JOINs and more
https://pganalyze.com/blog/5mins-post...
"Planner chooses incremental [sort] but not the best [index]" discussion on pgsql-hackers
https://www.postgresql.org/message-id...
"estimate_num_groups" function in Postgres
https://github.com/postgres/postgres/...
"Add enable_presorted_aggregate GUC" commit by David Rowley in Postgres 16
https://git.postgresql.org/gitweb/?p=...
"Add proper planner support for ORDER BY / DISTINCT aggregates" discussion on pgsql-hackers
https://www.postgresql.org/message-id...)
#postgres #postgresql #queryoptimization