{"type":"rich","version":"1.0","provider_name":"Transistor","provider_url":"https://transistor.fm","author_name":"Postgres FM","title":"Slow count","html":"<iframe width=\"100%\" height=\"180\" frameborder=\"no\" scrolling=\"no\" seamless src=\"https://share.transistor.fm/e/cf702ff3\"></iframe>","width":"100%","height":180,"duration":2605,"description":"Nikolay and Michael discuss why counting can be slow in Postgres, and what the options are for counting things quickly at scale.\n \nHere are some links to things they mentioned:\nAggregate functions (docs) https://www.postgresql.org/docs/current/functions-aggregate.html\nPostgREST https://github.com/PostgREST/postgrest \nGet rid of count by default in PostgREST https://github.com/PostgREST/postgrest/issues/273 \nFaster PostgreSQL Counting (by Joe Nelson on the Citus blog) https://www.citusdata.com/blog/2016/10/12/count-performance \nOur episode on Index-Only Scans https://postgres.fm/episodes/index-only-scans\nPostgres HyperLogLog https://github.com/citusdata/postgresql-hll\nOur episode on Row estimates https://postgres.fm/episodes/row-estimates \nOur episode about dangers of NULLs https://postgres.fm/episodes/nulls-the-good-the-bad-the-ugly-and-the-unknown \nAggregate expressions, including FILTER https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES\nSpread writes for counter cache (tip from Tobias Petry) https://x.com/tobias_petry/status/1475870220422107137\npg_ivm extension (Incremental View Maintenance) https://github.com/sraoss/pg_ivm \npg_duckdb announcement https://motherduck.com/blog/pg_duckdb-postgresql-extension-for-duckdb-motherduck\nOur episode on Queues in Postgres https://postgres.fm/episodes/queues-in-postgres\nOur episode on Real-time analytics https://postgres.fm/episodes/real-time-analytics\nClickHouse acquired PeerDB https://clickhouse.com/blog/clickhouse-acquires-peerdb-to-boost-real-time-analytics-with-postgres-cdc-integration\nTimescale Continuous Aggregates https://www.timescale.com/blog/materialized-views-the-timescale-way\nTimescale editions https://docs.timescale.com/about/latest/timescaledb-editions\nLoose indexscan https://wiki.postgresql.org/wiki/Loose_indexscan\n\n~~~\nWhat did you like or not like? What should we discuss next time? Let us know via a YouTube comment, on social media, or by commenting on our Google doc!\n\n~~~...","thumbnail_url":"https://img.transistorcdn.com/NFbJlGhGV5mzIU1kM0iZ823A69pjZUNX40LszVO5LKI/rs:fill:0:0:1/w:400/h:400/q:60/mb:500000/aHR0cHM6Ly9pbWct/dXBsb2FkLXByb2R1/Y3Rpb24udHJhbnNp/c3Rvci5mbS9zaG93/LzMyMTQ3LzE3MTA3/OTEzODMtYXJ0d29y/ay5qcGc.webp","thumbnail_width":300,"thumbnail_height":300}