Databases · Middle · Question 5 of 75

What is a partial index?

CREATE INDEX ON orders (created_at) WHERE status = 'pending';

Explanation

It's great when queries always filter on a rare value. A partial unique index can also enforce rules like 'one active subscription per user'.

Further reading

Problem with a question

Databases · Middle · question 5

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz