Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Indexes on expressions
Partial indexes
10. When to create partial indexes
Clustered indexes
Summary

Instruction

Perfect. Keep in mind that partial indexes are an advanced topic. They should only be used when you really know what you're doing, and you know the data in the table very well. As we said previously, partial indexes take up less space than regular indexes. In most cases, though, using a partial index instead of a regular index won't be much of an advantage.

Exercise

Let's create one more partial index for practice. You're given the same table:

CREATE TABLE house (
  id integer PRIMARY KEY,
  state char(2),
  zip_code char(5),
  price decimal(10, 2),
  bedrooms integer,
  built_year integer
);

Create an index named bedrooms_after2010 on the column bedrooms, but only for houses built after 2010.