{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa", "published": "2026-10-19T07:41:23Z", "publisher": "PostgresAI", "article": {"title": "PostgreSQL Tuning: Database Indexes", "url": "https://www.tigerdata.com/learn/postgresql-performance-tuning-optimizing-database-indexes", "date_published": "2024-03-06T15:53:15.567Z", "author": "Umair Shahid and Carlota Soto", "publisher": "Tiger Data"}, "grade": "A-", "axes": [{"axis": "Factual", "summary": "B+ \u00b7 1 wrong of 12 checked \u00b7 1 caveat"}, {"axis": "Applicable", "summary": "B+ \u00b7 1 wrong of 7 checked \u00b7 0 caveats"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 12 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 6 checked \u00b7 1 caveat"}, {"axis": "Safe", "summary": "A \u00b7 0 wrong of 11 checked \u00b7 0 caveats"}], "findings": [{"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F13", "claim": "\u2026indexes on the referenced columns, making operations like cascading updates or deletes faster.", "explanation": "Referenced keys already have supporting indexes. Cascades search the referencing table. PostgreSQL 16.2 documents indexing referencing columns at doc/src/sgml/ddl.sgml:1187-1190. Adding another referenced-key index does not address that scan.", "verdict": "False", "sources": [{"url": "https://github.com/postgres/postgres/blob/b78fa8547d02fc72ace679fb4d5289dccdbfc781/doc/src/sgml/ddl.sgml#L1182-L1194", "label": "REL_16_2 \u00b7 doc/src/sgml/ddl.sgml:1182-1194"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ddl.sgml#L1395-L1398", "label": "REL_18_6 \u00b7 doc/src/sgml/ddl.sgml:1395-1398"}, {"url": "https://github.com/postgres/postgres/blob/b78fa8547d02fc72ace679fb4d5289dccdbfc781/doc/src/sgml/ddl.sgml#L1187-L1190", "label": "REL_16_2 \u00b7 doc/src/sgml/ddl.sgml:1187-1190"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F3", "claim": "\u2026After adding or removing an index, update statistics using the `ANALYZE` command on the affected table.", "explanation": "New non-expression indexes immediately use existing column statistics. REL_16_2 doc/src/sgml/ref/create_index.sgml:783-789 distinguishes expression indexes, which need their own statistics. Adding or removing an ordinary index does not itself change column distributions. The blanket recommendation adds unnecessary ANALYZE work.", "verdict": "Misleading", "sources": [{"url": "https://github.com/postgres/postgres/blob/b78fa8547d02fc72ace679fb4d5289dccdbfc781/doc/src/sgml/ref/create_index.sgml#L783-L791", "label": "REL_16_2 \u00b7 doc/src/sgml/ref/create_index.sgml:783-791"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/create_index.sgml#L782-L798", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/create_index.sgml:782-798"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F2", "claim": "\u2026instead of a single transaction for the entire hypertable\u2026", "explanation": "Ordinary CREATE INDEX uses one transaction across chunks. TimescaleDB 2.30.2 src/process_utility.c:3925-3926 selects that branch unless multitransaction mode is enabled. The linked documentation supplies WITH (timescaledb.transaction_per_chunk). Omitting it gives a different concurrency profile.", "verdict": "Mostly accurate", "sources": [{"url": "https://github.com/timescale/timescaledb/blob/8f27a70d054fc80c4bbc722d8df4b6b305a7e93d/src/process_utility.c#L2742-L2764", "label": "timescaledb@2.14.2 \u00b7 src/process_utility.c:2742-2764"}, {"url": "https://github.com/timescale/timescaledb/blob/b0977bf2d3a5014ee870247be09bc19d3e9f7a5f/src/process_utility.c#L3919-L3946", "label": "timescaledb@2.30.2 \u00b7 src/process_utility.c:3919-3946"}, {"url": "https://www.tigerdata.com/docs/reference/timescaledb/hypertables/create_index", "label": "https://www.tigerdata.com/docs/reference/timescaledb/hypertables/create_index"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F4", "claim": "\u2026where product_available = \u2018true\u2019\u2026", "explanation": "SQL strings use ASCII single quotes. REL_16_2 doc/src/sgml/syntax.sgml:306-311 defines that delimiter. The characters surrounding true are curly quotes. PostgreSQL does not interpret them as string delimiters.", "verdict": "Misquoted", "sources": [{"url": "https://github.com/postgres/postgres/blob/b78fa8547d02fc72ace679fb4d5289dccdbfc781/doc/src/sgml/syntax.sgml#L306-L311", "label": "REL_16_2 \u00b7 doc/src/sgml/syntax.sgml:306-311"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F8", "claim": "`random_page_cost` is often too high, which causes the planner to avoid index scans\u2026", "explanation": "random_page_cost affects estimated random-page I/O during planning. Raising it relative to seq_page_cost makes index scans more expensive. REL_18_6 src/backend/optimizer/path/costsize.c:741 multiplies fetched pages by the random-page cost.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L6006-L6064", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:6006-6064"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/path/costsize.c#L734-L754", "label": "REL_18_6 \u00b7 src/backend/optimizer/path/costsize.c:734-754"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F9", "claim": "`random_page_cost and seq_page_cost`may not be set accurately according to your resources.", "explanation": "seq_page_cost estimates sequential page-fetch cost during planning. REL_18_6 src/backend/optimizer/path/costsize.c:323 multiplies the table's page count by its tablespace-adjusted value. The article correctly identifies it as a possible source of scan-cost misestimation.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L5989-L6004", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:5989-6004"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/optimizer/path/costsize.c#L314-L324", "label": "REL_18_6 \u00b7 src/backend/optimizer/path/costsize.c:314-324"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F10", "claim": "Setting a higher value of `maintenance_work_mem` can substantially speed up the index creation process\u2026", "explanation": "Index creation uses maintenance_work_mem for maintenance sorting. REL_18_6 src/backend/access/nbtree/nbtsort.c:430-433 passes it to the B-tree tuplesort. More memory can reduce external sorting when memory limits constrain the build.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/config.sgml#L1999-L2027", "label": "REL_18_6 \u00b7 doc/src/sgml/config.sgml:1999-2027"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/access/nbtree/nbtsort.c#L425-L433", "label": "REL_18_6 \u00b7 src/backend/access/nbtree/nbtsort.c:425-433"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F11", "claim": "\u2026Postgres can employ an `INDEX ONLY` scan and never have to touch the table.", "explanation": "An index-only scan can return covered data without visiting the heap when the corresponding visibility-map bit is set. REL_18_6 doc/src/sgml/indices.sgml:1217-1219 describes that condition. The article's sometimes qualification preserves this reading.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L1209-L1233", "label": "REL_18_6 \u00b7 doc/src/sgml/indices.sgml:1209-1233"}]}, {"anchor": "F14", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F14", "claim": "\u2026hash, GIN, GiST, or BRIN.", "title": "PostgreSQL supports the listed index access methods", "explanation": "PostgreSQL 18 section 11.2 lists Hash, GIN, GiST, and BRIN alongside B-tree and SP-GiST.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com", "label": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com"}]}, {"anchor": "F15", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F15", "claim": "\u2026Supports <, <=, =, >=, >, BETWEEN, IN, IS NULL, IS NOT NULL.", "title": "B-tree supports the listed comparisons and null tests", "explanation": "PostgreSQL 18 section 11.2.1 confirms B-tree support for the listed comparisons, BETWEEN, IN, IS NULL, and IS NOT NULL.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com", "label": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com"}]}, {"anchor": "F16", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F16", "claim": "\u2026Doesn't support range queries or sorting.", "title": "Hash indexes do not provide range or ordered access", "explanation": "PostgreSQL 18 section 11.2.2 limits hash indexes to equality comparisons. Hash indexes cannot supply range searches or ordered retrieval.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com", "label": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com"}]}, {"anchor": "F17", "url": "https://pgtrue.postgres.ai/shared/brief/85d9c881-2326-4d70-99bb-9c1229ca6cfa#F17", "claim": "\u2026supports indexing of complex data types such as geometric shapes\u2026", "title": "GiST supports built-in geometric data types", "explanation": "PostgreSQL 18 section 11.2.3 documents GiST operator classes for several two-dimensional geometric types.", "verdict": "Accurate", "sources": [{"url": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com", "label": "https://www.postgresql.org/docs/current/indexes-types.html?ref=tigerdata.com"}]}]}