{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285", "published": "2026-10-28T09:21:59Z", "publisher": "PostgresAI", "article": {"title": "How Bits Database Optimization proves a query rewrite is faster", "url": "https://www.datadoghq.com/blog/how-bits-database-optimization-proves-a-query-rewrite-is-faster", "date_published": "2026-08-31T00:00:00Z", "author": "Alex Weisberger, Nenad Novelji\u0107, Bowen Chen", "publisher": "The Monitor"}, "grade": "A-", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 11 checked \u00b7 0 caveats"}, {"axis": "Applicable", "summary": "B+ \u00b7 1 wrong of 4 checked \u00b7 1 caveat"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 11 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 4 checked \u00b7 0 caveats"}, {"axis": "Safe", "summary": "0 wrong \u00b7 0 caveats \u00b7 1 checked"}], "findings": [{"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F2", "claim": "\u2026Dirtied blocks: The number of blocks modified during query execution that must eventually be persisted to storage\u2026", "explanation": "shared_blks_dirtied counts clean-to-dirty transitions. src/backend/storage/buffer/bufmgr.c:3010 increments the counter only when BM_DIRTY was unset. Repeated writes to an already dirty buffer add no dirtied-block count. The article's definition overstates what this benchmark metric measures.", "verdict": "Misleading", "sources": [{"url": "https://docs.datadoghq.com/database_monitoring/bits_database_optimization/", "label": "https://docs.datadoghq.com/database_monitoring/bits_database_optimization/"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/explain.sgml#L197-L198", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/explain.sgml:197-198"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/buffer/bufmgr.c#L3010-L3012", "label": "REL_18_6 \u00b7 src/backend/storage/buffer/bufmgr.c:3010-3012"}]}, {"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F1", "claim": "\u2026restoring the database to its pre-warm-up state\u2026", "title": "Rollback does not restore every database state", "explanation": "ROLLBACK restores row visibility, but sequence advances survive aborts. PostgreSQL 18.6 documents this in doc/src/sgml/func.sgml:19952. Aborted inserts can also leave dead tuples for cleanup. Write benchmarks can therefore start with different sequence values and physical storage state.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L19952-L19953", "label": "REL_18_6 \u00b7 doc/src/sgml/func.sgml:19952-19953"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/sequence.c#L851-L854", "label": "REL_18_6 \u00b7 src/backend/commands/sequence.c:851-854"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/heap/heapam_visibility.c#L1218-L1224", "label": "REL_18_6 \u00b7 src/backend/access/heap/heapam_visibility.c:1218-1224"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F3", "claim": "\u2026uses these estimates to determine which plan to select\u2026", "title": "The planner uses estimated costs to select execution paths", "explanation": "PostgreSQL 18.6 builds candidate paths and converts a selected path into an execution plan. src/backend/optimizer/util/pathnode.c:364 compares total costs when selecting the cheapest path. The article correctly distinguishes these estimates from measured execution.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/util/pathnode.c#L364-L369", "label": "REL_18_6 \u00b7 src/backend/optimizer/util/pathnode.c:364-369"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/README#L20-L23", "label": "REL_18_6 \u00b7 src/backend/optimizer/README:20-23"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F4", "claim": "\u2026may not be accurately represented by statistics collected for each column independently\u2026", "title": "Single-column statistics omit cross-column correlation", "explanation": "PostgreSQL 18.6 documents this limitation in doc/src/sgml/perform.sgml:1398. Extended statistics can represent cross-column relationships. src/backend/statistics/dependencies.c:1352 describes combining predicate selectivities using functional dependency strength.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/perform.sgml#L1398-L1402", "label": "REL_18_6 \u00b7 doc/src/sgml/perform.sgml:1398-1402"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/statistics/dependencies.c#L1352-L1356", "label": "REL_18_6 \u00b7 src/backend/statistics/dependencies.c:1352-1356"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F5", "claim": "\u2026whether served from cache or read from storage\u2026", "title": "Logical reads include cache hits and storage reads", "explanation": "PostgreSQL 18.6 counts buffer cache hits separately from reads. src/backend/storage/buffer/bufmgr.c:1148 increments the shared-hit counter. Its read path increments shared_blks_read. Including both categories matches the article's description of logical reads.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/explain.sgml#L191-L192", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/explain.sgml:191-192"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/buffer/bufmgr.c#L1145-L1148", "label": "REL_18_6 \u00b7 src/backend/storage/buffer/bufmgr.c:1145-1148"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/storage/buffer/bufmgr.c#L1969-L1972", "label": "REL_18_6 \u00b7 src/backend/storage/buffer/bufmgr.c:1969-1972"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F7", "claim": "\u2026cache states, concurrent queries competing for CPU and I/O, and noisy neighbors can mask the true performance difference\u2026", "title": "Cache state and shared resources can affect timing comparisons", "explanation": "Shared resources let one workload degrade another workload's performance. PostgreSQL also distinguishes cached access from storage access costs. These effects support controlling benchmark conditions.", "verdict": "Accurate", "sources": [{"url": "https://learn.microsoft.com/en-us/azure/architecture/antipatterns/noisy-neighbor/noisy-neighbor", "label": "https://learn.microsoft.com/en-us/azure/architecture/antipatterns/noisy-neighbor/noisy-neighbor"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L6033-L6034", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:6033-6034"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F8", "claim": "Earlier this year, Datadog announced Bits Database Optimization\u2026", "title": "The announcement predates the article within 2026", "explanation": "The linked announcement is dated June 9, 2026. That precedes the article's August 31, 2026 publication.", "verdict": "Accurate", "sources": [{"url": "https://www.datadoghq.com/blog/bits-database-optimization/", "label": "https://www.datadoghq.com/blog/bits-database-optimization/"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F9", "claim": "\u2026configure the Agent to collect these statistics from your databases\u2026", "title": "The linked setup documents column statistics collection", "explanation": "The linked setup requires a column statistics function in every database. It also documents enabling collect_column_statistics.enabled. This supports the configuration instruction, not the claimed fidelity gains.", "verdict": "Accurate", "sources": [{"url": "https://docs.datadoghq.com/database_monitoring/setup_postgres/selfhosted/?tab=postgres15", "label": "https://docs.datadoghq.com/database_monitoring/setup_postgres/selfhosted/?tab=postgres15"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F10", "claim": "\u2026the query being benchmarked may need to wait on database locks\u2026", "title": "Concurrent transactions can delay benchmark statements", "explanation": "PostgreSQL can make an updater wait for another updating transaction to commit or roll back. REL_18_6 documents this in doc/src/sgml/mvcc.sgml:343.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/mvcc.sgml#L343-L344", "label": "REL_18_6 \u00b7 doc/src/sgml/mvcc.sgml:343-344"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F11", "claim": "\u2026warm-up itself changes the simulated database state\u2026", "title": "Write warm-ups can change later executions", "explanation": "INSERT adds rows. Unique constraints reject duplicate constrained values. A committed warm-up can change later input data or make a repeated INSERT fail. These statements support the article's conditional warning.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/insert.sgml#L52-L52", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/insert.sgml:52-52"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ddl.sgml#L906-L908", "label": "REL_18_6 \u00b7 doc/src/sgml/ddl.sgml:906-908"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/d8f920e4-b547-48d5-9a7d-296af3619285#F12", "claim": "\u2026then evaluates the average, median, p95, and maximum values across those runs.", "title": "The four benchmark summaries match the product documentation", "explanation": "The documentation lists average, median, P95, and maximum for each metric. These match the article's four summaries.", "verdict": "Accurate", "sources": [{"url": "https://docs.datadoghq.com/database_monitoring/bits_database_optimization/", "label": "https://docs.datadoghq.com/database_monitoring/bits_database_optimization/"}]}]}