Hacker News new | ask | show | jobs
by comboy 2079 days ago
> row X that takes up 1kb. I replace it with row Y that takes up 500b. I then write row Z after row Y that takes up 500b.

I thought there is a fixed amount of space allocated per row and varying length blobs are stored elsewhere, is my understanding wrong?

1 comments

Yes. Rows are variable length. Think null values, strings, etc.

Only really large values that don't fit into a page are stored elsewhere, and only if they can't be compressed and made to fit. I think it's > 3kb. But I don't remember why that number comes to mind. Pages are 8kb.

2kb by default, configurable per-table with the toast_tuple_target storage parameter if you want more control: https://www.postgresql.org/docs/current/sql-createtable.html