DEV Community

Domantas Jurkus
Domantas Jurkus

Posted on • Edited on

Database partitioning

When working with entities that have datetimes, partition the SQL table ahead of time to avoid headaches in the future.

  • Partitioning enables faster lookup and faster dropping of old data.
  • Prisma ORM does not allow adding a date field to the primary key: https://github.com/prisma/prisma/issues/17244
  • Workaround: generate day-of-year as a separate column.

https://mysql.rjweb.org/doc.php/partitionmaint

Top comments (0)