Data Migration Preparation for Rideshare

Imagine you’ve decided to migrate all the rows in the current rideshare.trip_positions table into a partitioned structure by month. The hypothetical example you looked at earlier considered a daily partition design, but we’ll use a month here for fewer partitions.

This means there will be one partition that corresponds to each calendar month of the year. You don’t need a partition for every month of all time, only for the months where you have data.

Use the pgslice --dry-run option as you start, to explore the SQL statements it generates.

To use pgslice, set up a PGSLICE_URL environment variable that has a connection string for the Rideshare database. This variable was added to the .env file in Rideshare. ...

Get High Performance PostgreSQL for Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.