[retry with correct address]
Bruce Momjian wrote:
>
> FAQ updated to take advantage of rollback-able DROP TABLE:
>
> BEGIN;
> LOCK TABLE old_table;
> SELECT ... -- select all columns but the one you want to remove
> INTO TABLE new_table
> FROM old_table;
> DROP TABLE old_table;
> ALTER TABLE new_table RENAME TO old_table;
> COMMIT;
Depending on the dataset and the dominant query types I frequently add
an ORDER BY clause to force a sort on the data as it resides on the
disk. Not very usefull for datasets that change a lot, but it can help
for some queries.
BEGIN;
LOCK TABLE old_table;
SELECT ... -- select all columns but the one you want to remove
INTO TABLE new_table
FROM old_table
ORDER BY dominant_column;
DROP TABLE old_table;
ALTER TABLE new_table RENAME TO old_table;
COMMIT;
Jochem