We have a product log database which only produces insert sql。 But we found that The autovacuum process took so much memory。 it takes about 16 GB at peak, And it is happend about every 2 month。The folloing is the detail information, Any one know it?
And the table skytf.urs_user_log_201105 only has insert operation, and have no update,delete operations, So i think the table has no dead tuples! But why the autovacuum process takes so much memory on the table?
--top detail
top - 16:39:46 up 225 days, 1:12, 1 user, load average: 1.29, 1.51, 1.52
Tasks: 341 total, 2 running, 339 sleeping, 0 stopped, 0 zombie
Cpu(s): 4.8%us, 5.3%sy, 0.0%ni, 85.5%id, 4.1%wa, 0.0%hi, 0.4%si, 0.0%st
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29267 postgres 14 -1 27.0g 16g 2928 S 1.0 72.2 199:59.74 postgres: autovacuum launcher process
From the above, we can see that the autovacuum process taks about 16 gb;
--current sql
postgres=# select datname, current_query from pg_stat_activity where current_query !='<IDLE>';
datname | current_query
----------+-------------------------------------------------------------------------------------
skytf | autovacuum: VACUUM skytf.urs_user_log_201105 (to prevent wraparound)
--table size
skytf=> \dt+ urs_user_log_201105
List of relations
Schema | Name | Type | Owner | Size | Description
--------+---------------------+-------+--------+-------+-------------
skytf | urs_user_log_201105 | table | skytf | 62 GB |
(1 row)
--memory state
postgres@logdb-> free -m
total used free shared buffers cached
Mem: 24104 24028 75 0 4 5545
-/+ buffers/cache: 18479 5625
Swap: 16386 8824 7561