good old VACUUM FULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I posted many weeks ago about a severe problem with a table that was obviously bloated and was stunningly slow. Up to 70 seconds just to get a row count on 300k rows.

I removed the text column, so it really was just a few columns of fixed data.
Still very bloated. ÂTable size was 450M

The advice I was given was to do CLUSTER, but this did not reduce the table size in the least.
Nor performance.

Also to resize my free space map (which still does need to be done).
Since that involves tweaking the kernel settings, taking the site down and rebooting postgres and exposing the system to all kinds of risks and unknowns and expensive experimentations I was unable to do it and have had to hobble along with a slow table in my backend holding up jobs.

Much swearing that nobody should ever do VACUUM FULL. ÂManual advises against it. ÂOnly crazy people do that.

Finally I decide to stop taking advice.

ns=> explain analyze select count(*) from fastadder_fastadderstatus;
---------------------------------------------------------------------------------------------------------------------------------------------
ÂAggregate Â(cost=62602.08..62602.09 rows=1 width=0) (actual time=25320.000..25320.000 rows=1 loops=1)
 Â-> ÂSeq Scan on fastadder_fastadderstatus Â(cost=0.00..61815.86 rows=314486 width=0) (actual time=180.000..25140.000 rows=314493 loops=1)
ÂTotal runtime: 25320.000 ms

ns=> vacuum full fastadder_fastadderstatus;

took about 20 minutes

ns=> explain analyze select count(*) from fastadder_fastadderstatus;
----------------------------------------------------------------------------------------------------------------------------------------
ÂAggregate Â(cost=7478.03..7478.04 rows=1 width=0) (actual time=940.000..940.000 rows=1 loops=1)
 Â-> ÂSeq Scan on fastadder_fastadderstatus Â(cost=0.00..6691.82 rows=314482 width=0) (actual time=0.000..530.000 rows=314493 loops=1)
ÂTotal runtime: 940.000 ms

moral of the story: Âif your table is really bloated, just do VACUUM FULL

CLUSTER will not reduce table bloat in and identical fashion





[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux