Creating vertical partitions

In the video, you learned about vertical partitioning and saw an example.

For vertical partitioning, there is no specific syntax in PostgreSQL. You have to create a new table with particular columns and copy the data there. Afterward, you can drop the columns you want in the separate partition. If you need to access the full table, you can do so by using a JOIN clause.

In this exercise and the next one, you'll be working with the example database called pagila. It's a database that is often used to showcase PostgreSQL features. The database contains several tables. We'll be working with the film table. In this exercise, we'll use the following columns:

  • film_id: the unique identifier of the film
  • long_description: a lengthy description of the film

This exercise is part of the course

Database Design

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Create a new table called film_descriptions
___ ___ ___ (
    ___ INT,
    ___ ___
);

-- Copy the descriptions from the film table
___ ___ ___
SELECT ___, ___ FROM ___;