How is the read / write performance with the unlogged table different from index and non-index?
1 Answer
UNLOGGED
has no impact on the speed of SELECT
statements, but it makes all data modifying statements faster, because no WAL has to be written.
Tables without any index are very fast for INSERT
, because rows are just stuffed into the first best block of the “heap” where there is room. Indexes are up to an order of magnitude more expensive to modify, because the order has to be preserved.
The question of LOGGED
/UNLOGGED
is independent from the question of indexed/not indexed. Both UNLOGGED
and not indexed speed up data modifications.