0% found this document useful (0 votes)
3 views9 pages

Memory Parameters

The document outlines the configuration parameters for memory management in PostgreSQL, focusing on Shared Buffers, Work Memory, Maintenance Work Memory, and Autovacuum Work Memory. It provides default values and optimal settings for each parameter, emphasizing the importance of memory allocation for performance during operations like sorting, hashing, and maintenance tasks. Additionally, it notes that only one maintenance operation can run at a time and discusses the limitations of autovacuum memory usage.

Uploaded by

Kirhn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views9 pages

Memory Parameters

The document outlines the configuration parameters for memory management in PostgreSQL, focusing on Shared Buffers, Work Memory, Maintenance Work Memory, and Autovacuum Work Memory. It provides default values and optimal settings for each parameter, emphasizing the importance of memory allocation for performance during operations like sorting, hashing, and maintenance tasks. Additionally, it notes that only one maintenance operation can run at a time and discusses the limitations of autovacuum memory usage.

Uploaded by

Kirhn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

MODULE -3

Tune Configuration Parameters


MEMORY PARAMETERS

Shared_Buffers Work_Mem

Maintenance_Work_Mem AutoVacuum_Work_Mem
Shared_Buffers
It is a parameter determines how much
Shared Buffer 1 memory is dedicated to the server for caching
data.
W The value for shared_buffers should never be
R
R set to reserve all of the system RAM for
E
I Postgresql.
A OS Cache 2 The Default Value is 128MB.
T
D
E 25%- 40% of Ram is considered optimal for
Shared_Buffers.

3 Clock sweep algorithm controls Buffer


Allocation and Eviction.
Disk
IOPS
Empty Used Buffer Dirty Buffer
Buffer Hash Table
Buffer Buffer Pages
Tags Ids (Meta
)

4 1 2 5 2 3

Clock Sweep
The amount of memory to be used by internal sort
operations and hash tables before writing to temporary
disk files.

Sort operations are used for order by, distinct and


merge join operations. Hash tables are used in hash
joins and hash-based aggregation.

Limit acts as a primitive resource control, preventing the


server from going into swap due to overallocation

WORK_ME Complex query, several sort or hash operations might


M be running in parallel, and each operation will generally
be allowed to use as much memory as this value

The default value is four megabytes (4MB ).

The memory limit for a hash table is computed by


multiplying work_mem by hash_mem_multiplier.
Query: Higher Tune
DBA
Value
1. ORDER
BY

2. DISTINCT
4MB
Sort
3. MERGE JOINS
Work_Mem Disk - /Tmp files

4. HASH JOINS
Maximum amount of memory to be used by maintenance
operations, such as VACUUM, CREATE INDEX, and ALTER TABLE ADD
FOREIGN KEY.

The Default value is 64Mb.

Only one of these operations can be executed at a time by a


database session.

Larger settings might improve performance for vacuuming and for


MAINTENANCE_WORK_MEM restoring database dumps.

Each auto vacuum worker process uses maintenance_work_mem


for its operation by default.

Autovacuum_max_workers times the memory may be allocated on


each auto vacuum run.

We can instruct auto vacuum not to use maintenance_work_mem


by setting a value for autovacuum_work_mem.
Specifies the maximum amount of memory to be
used by each autovacuum worker process.

Default is -1.

AUTOVACUUM_WORK_M
autovacuum is only able to utilize up to a maximum
EM of 1GB of memory.

Setting autovacuum_work_mem to a value higher


than that has no effect on the number of dead
tuples that autovacuum can collect while scanning
a table.

maintenance_work_mem will be used if


autovacuum_work_mem is not configured.
THANK YOU
For Your Time

You might also like