Speed up the logs dashboard

Speed up the logs dashboard

An ops dashboard filters logs by level — 'error', 'warn', 'info'. On a 50M-row table that turned into a 4-second query: Postgres has to read the whole thing. Build a logs table with id (primary key), level (up to 20 chars), and message (text), then create an index on level named logs_level_idx — it'll fix this immediately.

Just CREATE/ALTER/DROP — no trailing SELECT needed.

PostgreSQLv16

Your query result will appear here

No starting schema

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

Focus radio
Paused · SomaFM · Fluid