Should we skip dropped columns when vacuuming (full) table ?
- Dominant language
- C
- Stars
- 12.8k
- Forks
- 794
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 31
Description
```sql
CREATE TABLE columnar_table (a int, b int, c int, d int) USING columnar;
INSERT INTO columnar_table SELECT i, i, i, i from generate_series(1, 100) i;
ALTER TABLE columnar_table DROP COLUMN c;
ALTER TABLE columnar_table DROP COLUMN a;
VACUUM FULL columnar_table;
-- column_count is still 4 after table rewrite, not 2
SELECT cs.* FROM columnar.stripe cs
WHERE cs.storage_id = columnar_test_helpers.columnar_relation_storageid('columnar_table'::regclass);
┌─────────────┬────────────┬─────────────┬─────────────┬──────────────┬─────────────────┬───────────┬───────────────────┬──────────────────┐
│ storage_id │ stripe_num │ file_offset │ data_length │ column_count │ chunk_row_count │ row_count │ chunk_group_count │ first_row_number │
├─────────────┼────────────┼─────────────┼─────────────┼──────────────┼─────────────────┼───────────┼───────────────────┼──────────────────┤
│ 10000000001 │ 1 │ 16336 │ 420 │ 4 │ 10000 │ 100 │ 1 │ 1 │
└─────────────┴────────────┴─────────────┴─────────────┴──────────────┴─────────────────┴───────────┴───────────────────┴──────────────────┘
(1 row)
```
As far as I understand, `heapAM` avoids writing dropped columns to new storage (see the comment in `reform_and_rewrite_tuple`).
The only downside of the current approach seems storing redundant `existsArray`s that are all set to `False` vaues for such columns, but it still could be a nice improvement.
Contributor guide
Assessment
This issue has not been assessed yet.