3 ms·
This thing? https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver16 https://learn.microsoft.com/en-us/sql/relati
by adontz 2y ago
This thing? https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver16 https://learn.microsoft.com/en-us/sql/relational-databases/t...
Are not we talking about PostgreSQL?
- b-man 2y agoTemporal tables are an implementation of one of SQL 2011's main features: system time. https://sigmodrecord.org/publications/sigmodRecord/1209/pdfs/07.industry.kulkarni.pdf https://sigmodrecord.org/publications/sigmodRecord/1209/pdfs... Postgres itself has not yet added such to the core, since it moves about as fast as an elephant. There are extensions that do implement it (https://wiki.postgresql.org/wiki/Temporal_Extensions https://wiki.postgresql.org/wiki/Temporal_Extensions).
- adontz 2y agoHelp me here please. I really do not see how WHERE CURRENT_TIMESTAMP BETWEEN start AND end is much better than WHERE deleted_at IS NOT NULL Also, if we are talking about real use case of audit, not a simplified artificial one, my real tables were more like changeset(id INT, timestamp DATETIME, user ^USER, host TEXT, ip_address TEXT, <other security data>) datatable1(id INT, created_at ^changeset, updated_at ^changeset, deleted_at ^changeset NULL, <other fields>) datatable2(id INT, created_at ^changeset, updated_at ^changeset, deleted_at ^changeset NULL, <other fields>) datatable3(id INT, created_at ^changeset, updated_at ^changeset, deleted_at ^changeset NULL, <other fields>)
- b-man 2y agoIt is better, as others have written, because it preserves integrity constraints.