Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTYji-0005XJ-Ri for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Mar 2014 15:30:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WTYji-0003To-A5 for pgsql-bugs@arkaria.postgresql.org; Fri, 28 Mar 2014 15:30:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTNq2-0001u4-67 for pgsql-bugs@postgresql.org; Fri, 28 Mar 2014 03:52:14 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WTNpr-0004xT-VZ for pgsql-bugs@postgresql.org; Fri, 28 Mar 2014 03:52:11 +0000 MIME-Version: 1.0 Subject: BUG #9751: PostgreSQL free btree index page cann't reuse bug? To: pgsql-bugs@postgresql.org From: digoal@126.com Date: Fri, 28 Mar 2014 03:51:48 +0000 Message-ID: <20140328035148.13967.60767@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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