vacuum analyze GROWS db ?!

From: Marcin Krol <mrkafk(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: vacuum analyze GROWS db ?!
Date: 2010-02-15 14:43:22
Message-ID: 4B795D8A.8090801@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everyone,

The app that created this db is written by me for a change. But I've
done simple VACUUM ANALYZE on the biggest table in db and got this:

before VACUUM ANALYZE:

hrs=# SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class
WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname =
'public') ORDER BY size_in_bytes DESC LIMIT 10;
size_in_bytes | relname
---------------+--------------------------------------
30474240 | hosts
548864 | reservation
106496 | reservation_hosts
49152 | reservation_businessneed_idx
40960 | hosts_ip_idx
40960 | hosts_hostname_idx
40960 | hosts_location_idx
40960 | hosts_additional_info_idx
40960 | reservation_status_idx
40960 | reservation_hosts_reservation_id_idx
(10 rows)

After:

hrs=# vacuum analyze hosts;
VACUUM

hrs=# SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class
WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname =
'public') ORDER BY size_in_bytes DESC LIMIT 10;
size_in_bytes | relname
---------------+---------------------------
82206720 | hosts
4194304 | hosts_ip_idx
3842048 | hosts_pkey
3522560 | hosts_hostname_idx
3416064 | hosts_location_idx
3022848 | hosts_additional_info_idx
2482176 | hosts_os_update_idx
2367488 | hosts_cpu_idx
2359296 | hosts_up_n_running_idx
2334720 | hosts_os_kind_id_idx
(10 rows)

W T F ?!

REINDEX helped:

hrs=# reindex table hosts;
REINDEX

hrs=# SELECT relpages * 8192 AS size_in_bytes, relname FROM pg_class
WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname =
'public') ORDER BY size_in_bytes DESC LIMIT 10;
size_in_bytes | relname
---------------+--------------------------------------
82206720 | hosts
548864 | reservation
106496 | reservation_hosts
49152 | reservation_businessneed_idx
49152 | hosts_ip_idx
40960 | reservation_status_idx
40960 | reservation_hosts_reservation_id_idx
40960 | reservation_hosts_host_id_idx
40960 | hosts_hostname_idx
40960 | hosts_location_idx

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcin Krol 2010-02-15 14:46:25 CLUSTER cannot complete
Previous Message Merlin Moncure 2010-02-15 14:24:00 Re: how to create a new composite type using already existing composite types