Skip to main content

Monotonically increasing

Monotonicity means unchanging (think monotone); a monotonic sequence is a sequence where the order of the value of the elements does not change. In other words, a monotonically-increasing sequence is a sequence whose values are sorted in ascending order and do not decrease. For example the sequences [1, 6, 7, 11, 131] or [2, 5, 5, 5, 6, 10]..

Monotonically-increasing values often appear in primary keys generated by production systems. In an analytics engineering context, you should avoid generating such values or assuming their existence in your models, because they make it more difficult to create an idempotent data model. Instead you should create a surrogate key which is derived from the unique component(s) of a row.