This is a patch for table/index fillfactor control discussed in
http://archives.postgresql.org/pgsql-hackers/2006-06/msg00175.php
Fillfactor works on CREATE, INSERT, UPDATE, COPY, VACUUM FULL, CLUSTER
and REINDEX, but is not done on dump/restore and GIN access method;
I'd like to ask those module developers to complete the patch, please.
This patch might help the TODO-item:
Allow CREATE INDEX to take an additional parameter for use with
special index types
but the patch rejects parameters except fillfactor currently.
If we want to implement the feature, it is needed to consider how to
store generic parameters passed at CREATE.
The following syntax are added:
- Table creation:
- CREATE TABLE table (columns) WITH (...)
- CREATE TABLE table WITH (...) AS SELECT/EXECUTE ...
- Index creation:
- CREATE INDEX index ON table USING btree (columns) WITH (...)
- CREATE TABLE table (i integer PRIMARY KEY WITH (...))
- ALTER TABLE table ADD PRIMARY KEY (columns) WITH (...)
- Alterating parameters for existing tables/indexes:
- ALTER TABLE/INDEX name SET (...)
The folloing is a test of the patch:
# CREATE TABLE tbl (i int) WITH (fillfactor=50);
# CREATE INDEX idx ON tbl USING btree (i) WITH (fillfactor=50);
# INSERT INTO tbl SELECT generate_series(1, 100000);
| relname | relfillfactor | relpages |
+---------+---------------+----------+
| tbl | 50 | 1087 |
| idx | 50 | 494 |
# ALTER TABLE tbl SET (fillfactor = 100);
# ALTER INDEX idx SET (fillfactor = 100);
# CLUSTER idx ON tbl;
# REINDEX INDEX idx;
| relname | relfillfactor | relpages |
+---------+---------------+----------+
| tbl | 100 | 541 |
| idx | 100 | 249 |
---
ITAGAKI Takahiro
NTT OSS Center