ClickHouse/tests/queries/0_stateless/02521_lightweight_delete_and_ttl.reference
2023-01-09 12:05:52 +01:00

26 lines
1.3 KiB
Plaintext

-- { echoOn }
SELECT 'Rows in parts', SUM(rows) FROM system.parts WHERE database = currentDatabase() AND table = 'lwd_test_02521' AND active;
Rows in parts 100000
SELECT 'Count', count() FROM lwd_test_02521;
Count 100000
DELETE FROM lwd_test_02521 WHERE id < 25000;
SELECT 'Rows in parts', SUM(rows) FROM system.parts WHERE database = currentDatabase() AND table = 'lwd_test_02521' AND active;
Rows in parts 100000
SELECT 'Count', count() FROM lwd_test_02521;
Count 50000
ALTER TABLE lwd_test_02521 MODIFY TTL event_time + INTERVAL 1 MONTH SETTINGS mutations_sync = 1;
SELECT 'Rows in parts', SUM(rows) FROM system.parts WHERE database = currentDatabase() AND table = 'lwd_test_02521' AND active;
Rows in parts 50000
SELECT 'Count', count() FROM lwd_test_02521;
Count 25000
ALTER TABLE lwd_test_02521 DELETE WHERE id >= 40000 SETTINGS mutations_sync = 1;
SELECT 'Rows in parts', SUM(rows) FROM system.parts WHERE database = currentDatabase() AND table = 'lwd_test_02521' AND active;
Rows in parts 40000
SELECT 'Count', count() FROM lwd_test_02521;
Count 15000
OPTIMIZE TABLE lwd_test_02521 FINAL SETTINGS mutations_sync = 1;
SELECT 'Rows in parts', SUM(rows) FROM system.parts WHERE database = currentDatabase() AND table = 'lwd_test_02521' AND active;
Rows in parts 15000
SELECT 'Count', count() FROM lwd_test_02521;
Count 15000