O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Efficiently managing time to live and soft delete rows

RANGE COLUMNS is highly useful in managing time to live and soft delete rows. Suppose you have a application which specifies the expiry time of row (row to be deleted after it crosses the expiry time) and the expiry is varying.

Suppose the application can do the following types of inserts:

  • Insert persistent data
  • Insert with expiry

If the expiry is constant i.e all the rows inserted will be deleted after certain time, we can go with RANGE partitioning. But if the expiry is varying i.e some rows will be deleted in a week, some in a month, some in a year and some have no expiry, it is not possible to create partitions. In that case, you can use the RANGE COLUMNS partitioning explained ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required