good old VACUUM FULL

Поиск
Список
Период
Сортировка
От felix
Тема good old VACUUM FULL
Дата
Msg-id AANLkTi=SMx4GiW5DLFTpOm4Go-ibipc6WpTN+4rY7tbF@mail.gmail.com
обсуждение исходный текст
Ответы Re: good old VACUUM FULL  (Chris <dmagick@gmail.com>)
Re: good old VACUUM FULL  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-performance
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




В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Analyze on temp table taking very long
Следующее
От: Chris
Дата:
Сообщение: Re: good old VACUUM FULL