tstzrange is absolutely awesome. Especially when you put an index on such a column. You safe so much code and hassling just by letting your DB do it. Performance and consistency included.
I wrote a prototype Prometheus caching proxy using postgres range types (it’s built around the idea that when dashboard refresh creates a very predictable read pattern and you can stitch together old data and fresh data). It seemed bizarre to cache json from a tsdb in postgres, but indexable range types and operators made prototyping so much easier. https://github.com/shanemhansen/dashcache
(Disclaimer: this project never really got beyond “seems to work on my machine” status)
The range types are great. I was doing some stuff with AWS Redshift recently and was heartbroken to realize that Redshift is based on an older version of Postgres (8.0.2! GWB had just started his second term when that was released! XP was the latest version of Windows! The original iPhone was more than two years in the future!) that lacks them.
This is from 2016, Basecamp are embarking on a big hiring spree, and much bigger teams.
I’d love them to do a recap in 2022, and wonder if this majestic monolith will still be there preferred architechture.
Basecamp have been building monoliths for 15 years. I doubt anything has changed.
I’d never come across range types for times before (https://www.postgresql.org/docs/current/static/rangetypes.html) thanks!
tstzrange is absolutely awesome. Especially when you put an index on such a column. You safe so much code and hassling just by letting your DB do it. Performance and consistency included.
Agreed. You can even make sure that ranges dont overlap based on some other column(s) in the record.
I wrote a prototype Prometheus caching proxy using postgres range types (it’s built around the idea that when dashboard refresh creates a very predictable read pattern and you can stitch together old data and fresh data). It seemed bizarre to cache json from a tsdb in postgres, but indexable range types and operators made prototyping so much easier. https://github.com/shanemhansen/dashcache
(Disclaimer: this project never really got beyond “seems to work on my machine” status)
The range types are great. I was doing some stuff with AWS Redshift recently and was heartbroken to realize that Redshift is based on an older version of Postgres (8.0.2! GWB had just started his second term when that was released! XP was the latest version of Windows! The original iPhone was more than two years in the future!) that lacks them.
Kiva - https://www.kiva.org/