Creating a 'metrics' schema - how to best run calculations at some interval

A number of my tables are related to one another where the main table will have metrics such as 'time between' the creation of a record and a status or change to that record (not just some 'updated' date).

For example, record A is created on Monday. On Friday the record is completed.

I want to record the count of days between those events, such would be "4" days.

Where should this type of calculation occur? Are there best practices I can follow?

3 replies