Use Partitioning to Help with Archiving

When is partitioning useful? Partitioning can provide three benefits, which we’ll cover in this chapter. These benefits aren’t guaranteed, though, and you’ll need to test your own database queries, schema, indexes, and usage patterns to determine how beneficial they are. What are the benefits we will look at?

Commonly, time-oriented data isn’t needed in the main database after some time has passed. We could consider the trip positions data mentioned earlier. Outside of the original trip or maybe a reporting period afterward where the rider needs a receipt or the driver needs to get paid based on their work performed, how long would the geo data really be needed?

By removing older unneeded data, which we’ll ...

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.