QA
Senior LevelPostgreSQL

How do Dynamic Shared Memory (DSM) segments coordinate memory between parallel query workers?

❓ Interview Prompt: Explain Dynamic Shared Memory (DSM), DSM segments, parallel query worker communication, and shared hash join memory allocation.

During parallel query execution, worker processes must exchange tuple data and hash tables. PostgreSQL uses Dynamic Shared Memory (DSM):

How DSM Works:

1
Leader process allocates a dynamic shared memory segment ('dsm_create').
2
Parallel worker backends attach to the DSM segment ('dsm_attach').
3
Workers construct shared Hash Join tables in DSM memory, avoiding IPC copying overhead!

Code Implementation Example

sql
-- Inspect DSM dynamic shared memory allocations in system views
SELECT * FROM pg_shmem_allocations WHERE name LIKE '%Dynamic%';
💡Inspecting dynamic shared memory allocations.
🎯 Interview Key Takeaway

Dynamic Shared Memory (DSM) enables zero-copy parallel worker communication for parallel joins and sorts.

#DSM#Dynamic Shared Memory#Parallel Query#Senior
Back to all PostgreSQL Questions→

More PostgreSQL Interview Questions

Beginner LevelPostgreSQL

How to use pgvector in PostgreSQL for vector similarity search with HNSW indexes?

Beginner LevelPostgreSQL

What is PostgreSQL architecture and how do client backends connect via process fork model?

Beginner LevelPostgreSQL

What special built-in data types exist in PostgreSQL (JSONB, UUID, ARRAY, INET, TEXT)?