Consistency


Last Updated on Feb 09, 2021

Consistency is the idea that certain statements about application data should always remain true. These facts are usually called invariants, and they are part of the business logic of the application. Invariants ensure that application data is in a valid state at all times.

Databases are assumed to be in a valid state satisfying all invariants. As long as all writes during the transaction preserve data validity, it is guaranteed that invariants will remain satisfied.

Consistency is the responsibility of the application, not the database. It is the application's responsibility to define its transactions correctly so that they preserve consistency. Apart from certain kinds of invariants like foreign key constraints or uniqueness constraints that could be enforced by the database, what data is valid or invalid is ultimately defined by the application.


Related:

© 2022 Ambitious Systems. All Rights Reserved.