Technologies/PostgreSQL/postgresql.temp_files
PostgreSQLPostgreSQLMetric

postgresql.temp_files

Temporary files created
Dimensions:None
Available on:DatadogDatadog (1)Native (1)OpenTelemetryOpenTelemetry (1)PrometheusPrometheus (1)
Interface Metrics (4)
DatadogDatadog
The number of temporary files created by queries in this database. This metric is tagged with db.
Dimensions:None
Native
Number of temporary files created
Dimensions:None
OpenTelemetryOpenTelemetry
The number of temp files.
Dimensions:None
PrometheusPrometheus
Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.
Dimensions:None

Technical Annotations (14)

Configuration Parameters (3)
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
CLI Commands (3)
SHOW work_mem;diagnostic
SET work_mem = '10MB';remediation
EXPLAIN (ANALYZE) SELECT ... ORDER BY ...;diagnostic
Technical References (8)
external mergeconceptSort Methodconcepttop-N heapsortconcepttemp filesconcepttemp_bytesconceptDisk Merge Sortconceptpg_stat_statementscomponentwork_memcomponent
Related Insights (4)
Sort spills to disk when work_mem is too lowwarning
Undersized memory settings force sorts and joins to diskwarning
Low work_mem forces disk-based sorts degrading query performancewarning
Inadequate work_mem causes query spill to diskwarning