Exercise

Creating horizontal partitions

In the video, you also learned about horizontal partitioning.

The example of horizontal partitioning showed the syntax necessary to create horizontal partitions in PostgreSQL. If you need a reminder, you can have a look at the slides.

In this exercise, however, you'll be using a list partition instead of a range partition. For list partitions, you form partitions by checking whether the partition key is in a list of values or not.

To do this, we partition by LIST instead of RANGE. When creating the partitions, you should check if the values are IN a list of values.

We'll be using the following columns in this exercise:

  • film_id: the unique identifier of the film
  • title: the title of the film
  • release_year: the year it's released

Instructions 1/3

undefined XP
    1
    2
    3
  • Create the table film_partitioned, partitioned on the field release_year.