APPENDIX · P7 · DELETION · SLIDE 16
← Back to Slide 16
P7. Deleted rows are still on the disk
SELECT count() FROM events
WHERE player_id = 1042;
SELECT count() FROM events
WHERE player_id = 1042
SETTINGS apply_deleted_mask = 0;
SELECT command, is_done FROM system.mutations
WHERE database = currentDatabase() AND table = 'events';
What the result should be
0 // запросы не видят
56 // байты ещё в частях
UPDATE damage = 0
WHERE player_id = 777 1
UPDATE _row_exists = 0
WHERE player_id = 1042 1
_row_exists
When will it disappear?
Mutation
Lightweight DELETE writes a mask: the row is hidden from queries, but the data remains in the partition.
When merging a partition or after an ALTER TABLE … APPLY DELETED MASK statement. A time period is required for on-demand deletion.
ALTER … UPDATE has rewritten the "damage" section in all parts: it's expensive, asynchronous, and reads are non-blocking.
apply_deleted_mask = 0 — a debug setting. It indicates that deletion in ClickHouse involves marking records and a deferred overwrite, rather than immediate erasure.