#805

Slice logs by year so old chunks can be dropped

Table logs collects 500M rows a year — indexes balloon, vacuum slows down, and deleting an old year row by row takes forever. The solution is partitioning by creation year: each chunk lives in its own physical table, and an outdated year can be dropped wholesale in milliseconds. Build a logs table with id (type BIGSERIAL), ts (timestamp with timezone, required), and payload (text), partitioned by range over ts. Create two partitions — logs_2024 for dates from January 1, 2024 up to January 1, 2025 (upper bound exclusive) and logs_2025 for the next year on the same principle. An insert lands in the right partition by date automatically.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

relname
logs_2024
logs_2025

Your query result will appear here

No starting schema

This task starts with no tables — you'll create them via CREATE TABLE.