
"Whether you're a database designer, programmer, analyst, or manager, you've probably encountered some of the challenges - and experienced some of the frustrations - associated with time-varying data. Where do you turn to fix the problem and see that it doesn't happen again? In Developing Time-Oriented Database Applications in SQL, a leading SQL researcher teaches you effective techniques for designing and building database applications that must integrate past and current data. Written to meet a pervasive, enduring need, this book will be indispensible if you happen to be part of the flurry of activity leading up to Y2K."--BOOK JACKET.
- Developing Time-Oriented Database Applications in SQL by Rich. Snodgrass: https://www.amazon.com/Developing-Time-Oriented-Database-App...
-----
Anything by Joe Celko:
- SQL for Smarties: https://www.amazon.com/gp/product/B00R17NZZC
- SQL Programming Style: https://www.amazon.com/gp/product/B006L21AO6
- Trees and Hierarchies in SQL for Smarties: https://www.amazon.com/gp/product/B006Y8MKUU
- Thinking in Sets: https://www.amazon.com/gp/product/B001AODZZC
-------
- SQL Antipatterns by Bill Karwin: https://www.amazon.com/SQL-Antipatterns-Programming-Pragmati...
edit: it contains many database-patterns that are useful even you aren't building time-oriented applications. It will make you a better developer.
edit 2: basically, once you know some things from this book, every time you encounter a new database engine or programming language, the first thing you will want to look at is how the language handles dates & times - suddenly this kind of field become way more interesting. So the book might change how you view dates/times permanently, just be careful if you tend to over-engineer or are perfectionist, because it makes it easy to do so. Apply the patterns when it makes pragmatic sense.
You can express forecasts this way. The valid time range is the range for which you assert a given forecast is going to be true. The transaction time range is the time during which you held that forecast to be the current forecast.
Using transaction time you can then reconstruct your state of belief from any point in time. Using valid time you can make assertions about any fact in ranges over the past, present or future.
I think Snodgrass's Developing Time-Oriented Database Applications in SQL[0] is still the best overall introduction, though the SQL used is fairly dated (ha). The relevant Wikipedia entry is OK too[1].
I'd love to see someone translate the concepts in both books to a useful postgres package. As Snodgrass points out, "Unfortunately, due to the noncompliance of all existing DBMSs, a few of these fragments run on no existing platform" and thus only discusses how they can be applied to DB2, MSSQL, Sybase, Oracle8 and UniSQL.
Richard Snodgrass, Developing Time-Oriented Database Applications in SQL.
Hugh Darwen & C.J. Date, "An Overview and Analysis of Proposals Based on the TSQL2 Approach".
Krishna Kulkarni & Jan-Eike Michels, "Temporal features in SQL:2011".
Tom Johnston, Managing Time in Relational Databases. (I haven't read this one yet.)
Tom Johnston, Bitemporal Data.
Magnus Hagander, "A TARDIS for Your ORM": https://www.youtube.com/watch?v=TRgni5q0YM8
Also I've yet to see anyone even talk about managing DDL changes in temporal databases (well Magnus mentions that he won't cover it), but it's the same problem as discussed here. It's very practical, but you could write a dissertation or a book about it.