From: digoal@126.com
To: pgsql-bugs@postgresql.org
Subject: BUG #9751: PostgreSQL free btree index page cann't reuse bug?
Date: Fri, 28 Mar 2014 03:51:48 +0000
Message-ID: <20140328035148.13967.60767@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 9751
Logged by: digoal.zhou
Email address: digoal@126.com
PostgreSQL version: 9.3.3
Operating system: CentOS 6.4 x64
Description:
PostgreSQL free btree index page cann't reuse in the future?
This is my test :
digoal=# create table test(id int primary key, info text, crt_time
timestamp);
CREATE TABLE
digoal=# insert into test select
generate_series(1,50000000),md5(random()::text),clock_timestamp();
INSERT 0 50000000
digoal=# \dt+ test
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------+-------+----------+---------+-------------
public | test | table | postgres | 3634 MB |
(1 row)
digoal=# \di+
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+-----------+-------+----------+-------+---------+-------------
public | test_pkey | index | postgres | test | 1063 MB |
(1 row)
digoal=# copy (select * from test where id<>50000000) to
'/ssd3/pg93/test.dmp' with (format csv, delimiter ',', null '\N', quote '"',
force_quote *) ;
digoal=# delete from test where id<50000000;
DELETE 49999999
-- The vacuum result tell us index item removed , and it's free.
digoal=# vacuum verbose analyze test;
INFO: vacuuming "public.test"
INFO: scanned index "test_pkey" to remove 49999999 row versions
DETAIL: CPU 0.17s/20.02u sec elapsed 23.89 sec.
INFO: "test": removed 49999999 row versions in 116279 pages
DETAIL: CPU 0.43s/1.34u sec elapsed 2.95 sec.
INFO: index "test_pkey" now contains 1 row versions in 34023 pages
DETAIL: 49999999 index row versions were removed.
33990 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO: "test": found 49999999 removable, 1 nonremovable row versions in
116280 out of 116280 pages
DETAIL: 0 dead row versions cannot be removed yet.
There were 0 unused item pointers.
0 pages are entirely empty.
CPU 1.14s/29.67u sec elapsed 36.84 sec.
INFO: vacuuming "pg_toast.pg_toast_34315"
INFO: index "pg_toast_34315_index" now contains 0 row versions in 1 pages
DETAIL: 0 index row versions were removed.
0 index pages have been deleted, 0 are currently reusable.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO: "pg_toast_34315": found 0 removable, 0 nonremovable row versions in 0
out of 0 pages
DETAIL: 0 dead row versions cannot be removed yet.
There were 0 unused item pointers.
0 pages are entirely empty.
CPU 0.00s/0.00u sec elapsed 0.00 sec.
INFO: analyzing "public.test"
INFO: "test": scanned 30000 of 116280 pages, containing 0 live rows and
14680 dead rows; 0 rows in sample, 1 estimated total rows
VACUUM
-- but when i load the data into test table, the index bloat up two times
than the first index size.
digoal=# copy test from '/ssd3/pg93/test.dmp' with (format csv, delimiter
',', null '\N', quote '"');
COPY 49999999
digoal=# \dt+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+------+-------+----------+---------+-------------
public | test | table | postgres | 3634 MB |
(1 row)
digoal=# \di+
List of relations
Schema | Name | Type | Owner | Table | Size | Description
--------+-----------+-------+----------+-------+---------+-------------
public | test_pkey | index | postgres | test | 2425 MB |
(1 row)
-- Why?
-- it's a bug?
-- and index page will reuse when the page free?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: digoal@126.com
Subject: Re: BUG #9751: PostgreSQL free btree index page cann't reuse bug?
In-Reply-To: <20140328035148.13967.60767@wrigleys.postgresql.org>
References: <20140328035148.13967.60767@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox