Technologies/PostgreSQL/postgresql.temp_bytes
PostgreSQLPostgreSQLMetric

postgresql.temp_bytes

Temporary file size
Dimensions:None
Available on:DatadogDatadog (1)Native (1)PrometheusPrometheus (1)
Interface Metrics (3)
DatadogDatadog
The amount of data written to temporary files by queries in this database. This metric is tagged with db.
Dimensions:None
Native
Amount of data written to temporary files
Dimensions:None
PrometheusPrometheus
Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.
Dimensions:None

Technical Annotations (20)

Configuration Parameters (4)
work_memrecommended: 10MB or higher based on sort size in EXPLAIN
controls memory available for sort operations before spilling to disk
shared_buffers
controls shared memory cache for table and index blocks
effective_cache_size
hints to planner about available OS cache
max_connections
determines total potential work_mem allocation
CLI Commands (7)
SHOW work_mem;diagnostic
SET work_mem = '10MB';remediation
EXPLAIN (ANALYZE) SELECT ... ORDER BY ...;diagnostic
ALTER SYSTEM SET work_mem = '64MB';remediation
SET work_mem = '256MB';remediation
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM orders ORDER BY total DESC;diagnostic
RESET work_mem;remediation
Technical References (9)
external mergeconceptSort Methodconcepttop-N heapsortconcepttemp filesconceptOOM Killercomponentwork_memconfigurationtemp_bytesconceptpg_stat_statementscomponentDisk Merge Sortconcept
Related Insights (6)
Sort spills to disk when work_mem is too lowwarning
Undersized memory settings force sorts and joins to diskwarning
Excessive work_mem allocation causes OOM Killer to terminate PostgreSQLcritical
Low work_mem forces disk-based sorts degrading query performancewarning
Inadequate work_mem causes query spill to diskwarning
Insufficient work_mem causes disk-based sorting and hashingwarning