Skip to content

Which way round to build a two-column index

Two queries run constantly:

sql SELECT * FROM events WHERE tenant_id = ? AND created_at > ?; SELECT * FROM events WHERE tenant_id = ?;

You may add one composite index. Which, and why?