Subjects Questions Quizzes Pricing
Advanced Open Pro

Covering Index Design

Your API has a route that serves a user's notification list:

SELECT id, title, is_read, created_at
FROM notifications
WHERE user_id = $1 AND is_read = false
ORDER BY created_at DESC
LIMIT 20;

This table has 50 million rows. Design the optimal index for this query. Explain your choices.

← Back to Database Indexing practice