Questions tagged [vacuum]

The vacuum command in postgres releases unused space. Be sure to also include the [postgres] tag, and version tag such as [postgresql-9.6]. Include an operating system tag,

Filter by
Sorted by
Tagged with
39 votes
3 answers
41k views

Are regular VACUUM ANALYZE still recommended under 9.1?

I'm using PostgreSQL 9.1 on Ubuntu. Are scheduled VACUUM ANALYZE still recommended, or is autovacuum enough to take care of all needs? If the answer is "it depends", then: I have a largish database (...
François Beausoleil's user avatar
36 votes
1 answer
52k views

VACUUM returning disk space to operating system

VACUUM usually does not return disk space to operating system, except in some special cases. From the docs: The standard form of VACUUM removes dead row versions in tables and indexes and marks the ...
Vadim Samokhin's user avatar
49 votes
5 answers
53k views

Aggressive Autovacuum on PostgreSQL

I'm trying to get PostgreSQL to aggressively auto vacuum my database. I've currently configured auto vacuum as follows: autovacuum_vacuum_cost_delay = 0 #Turn off cost based vacuum ...
CadentOrange's user avatar
46 votes
6 answers
54k views

I need to run VACUUM FULL with no available disk space

I have one table that is taking up close to 90% of hd space on our server. I have decided to drop a few columns to free up space. But I need to return the space to the OS. The problem, though, is ...
Justin Rhyne's user avatar
11 votes
2 answers
2k views

What fillfactor for caching table?

I have heavily updated / accessed table where I store serialized java objects. They are in the table for 2-3 hours (also are being updated during that period) and then removed. Size of table is around ...
Michal's user avatar
  • 163
5 votes
3 answers
4k views

How to reclaim disk space after delete without rebuilding table?

Our PostgreSQL 9.0 Windows production server is running low on space. In our 100GB database, we have a large table containing TOASTed binary data. We have deleted some rows and need to return the ...
Brendan Hill's user avatar
5 votes
2 answers
3k views

PostgreSQL unexplained table bloat

I have a table in a Postgres 8.2.15 database. The table bloated to almost 25GB but after running vacuum full and cluster the table size was dramatically smaller, well under 1GB. A few weeks later ...
yohaas's user avatar
  • 121
4 votes
2 answers
6k views

How to `vacuumlo` an RDS PostgreSQL database?

As you may have noticed, as a fully managed data base as a service product, AWS Relational Data base Service (RDS) restricts the execution of userland commands. I was staging a production database, ...
48347's user avatar
  • 66
32 votes
4 answers
59k views

How much time will a vacuum/autovacuum operation take?

I manage a big (some hundreds of gigs) database containing tables with various roles, some of them holding millions of records. Some tables only receive large number of inserts and deletes, some other ...
zaadeh's user avatar
  • 465
20 votes
4 answers
36k views

Should I manually VACUUM my PostgreSQL database if autovacuum is turned on?

I use software which makes a big PostgreSQL database (there is a table with a million rows in it) and the developers says I should VACUUM and ANALYZE periodically. But the PostgreSQL database default ...
kissgyorgy's user avatar
19 votes
1 answer
4k views

Is it worth it to run VACUUM on a table that only receives INSERTs?

In a 2015 re:Invent talk, AWS mentioned that vacuum should be run not only after updates or deletes but also after inserts. Here is the relevant part of the talk: http://www.youtube.com/watch?v=...
foobar0100's user avatar
11 votes
4 answers
14k views

VACUUM VERBOSE outputs, nonremovable "dead row versions cannot be removed yet"?

I have a Postgres 9.2 DB where a certain table has lots of nonremovable dead rows: # SELECT * FROM public.pgstattuple('mytable'); table_len | tuple_count | tuple_len | tuple_percent | ...
oliver's user avatar
  • 211
10 votes
1 answer
2k views

How to reclaim space taken by an index that partially built and was terminated by a power outage

I'm running postgres (postgis) 9.4.2 on a mac (10.10.4). I've got a couple big tables (several TBs). During an index build on one of them that takes about a week, I watched the available HD space ...
dkitchel's user avatar
  • 115
5 votes
1 answer
1k views

For alignment optimized table is bigger than original table - why?

In another question I learned that I should optimize the layout from one of my tables to save space and have better performance. I did this, but ended up with a larger table than before and ...
tomka's user avatar
  • 927
4 votes
1 answer
8k views

When is Postgres autovacuum executed

I am using an older version of Postgres (8.4.20). I know that the autovacuum process is executed frequently to free disk space of queries that deleted or updated data in tables. I have a database ...
user3455531's user avatar
1 vote
1 answer
1k views

Postgres: Reclaiming Space

I have a server with 150GB of diskspace. Today I uploaded a dataset of 30GB. I cancelled the import due to internet dying, then noticed there was 29GB of space missing in the database (meaning the CSV ...
ilovejq's user avatar
  • 55
27 votes
3 answers
41k views

VACUUM FREEZE vs. VACUUM FULL

Can someone explain the difference between these types of VACUUM in PostgreSQL? I read the doc but it just says that FULL locks the tables and FREEZE "freezes" the tuples. I think that's the same. Am ...
Christian Maíz's user avatar
12 votes
3 answers
9k views

Is it necessary to ANALYZE a table after an index has been created?

In my transaction, I am creating a temporary table: create temporary table x on commit drop as select ... I also add an index on that table: create index on x(some_column); Is it now necessary to ...
Kollp's user avatar
  • 123
11 votes
2 answers
15k views

Why wouldn't VACUUM ANALYZE clear all dead tuples?

We run a "manual" VACUUM ANALYZE VERBOSE on some of our larger tables after we do major DELETE/INSERT changes to them. This seems to work without issue although sometimes a table's VACUUM job will run ...
jwadsack's user avatar
  • 213
5 votes
2 answers
3k views

How to optimize a table for a very high-frequency updates?

I have a table that contains a list of tasks that need to be run periodically: applaudience=> \d+ maintenance_task Table "...
Gajus's user avatar
  • 1,145
4 votes
1 answer
4k views

Dropping indexes doesn't seem to release space to the OS. Can it?

I'm running PostgreSQL 9.1. I have noticed really alarmingly bad indexes are taking up a lot of space on my server, e.g: evlampts=# SELECT pg_size_pretty(pg_relation_size('mcdata_2011_07')) AS ...
Daniel Lyons's user avatar
4 votes
1 answer
2k views

Does postgres efficiently re-use space from deleted rows?

From the docs: In PostgreSQL, an UPDATE or DELETE of a row does not immediately remove the old version of the row [...] But eventually, an outdated or deleted row version is no longer of interest ...
Jack Douglas's user avatar
  • 39.7k
3 votes
1 answer
2k views

How do we get around PostgreSQL autovacuum taking a table-level lock ACCESS EXCLUSIVE on replicas?

We are running: user@primary/client-n:~$ psql -d database -c "SELECT version();" version --------------------------------------------...
dw8547's user avatar
  • 897
3 votes
2 answers
5k views

Vacuum vs Auto Vacuum

I am trying to find answers for my below few queries which will help me in fine tuning my postgres DB. I did some googling but was not able to find answer. 1) Out of vacuum or Auto vacuum which is ...
prvnsaini's user avatar
2 votes
1 answer
2k views

"Truncate" or "Delete/Vacuum Full" for deleting some of the table rows

I have a db which has 223 tables and I have to delete some of the records from 10 of them, each has apprx. 1.5million records. Those tables are storing the temperatures every 7seconds. We have decided ...
mctuna's user avatar
  • 145
2 votes
1 answer
374 views

Does AWS ever `vacuumlo` PostgreSQL RDS instances?

Link to the long story happened before (and reason to have) this question. Does AWS ever vacuumlo PostgreSQL RDS instances?
48347's user avatar
  • 66
1 vote
1 answer
618 views

Long running VACUUM VERBOSE in Postgres 9.5 - how much time remaining?

I am vacuuming a very large (718GB) table containing a lot of dead tuples and 4 indexes. VACUUM ANALYSE VERBOSE bigtable; This vacuum has been running for over 11 hours (!) now and I am trying to ...
100grams's user avatar
  • 121