Home / Companies / Tiger Data / Blog / Post Details
Content Deep Dive

How We Fixed Long-Running PostgreSQL now( ) Queries (and Made Them Lightning Fast)

Blog post from Tiger Data

Post Details
Company
Date Published
Author
Sven Klemm
Word Count
1,564
Language
English
Hacker News Points
18
Summary

TimescaleDB has optimized its `now()` function to improve query performance, particularly in hypertables with many chunks. The optimization works by rewriting the constraint to make the `now()` expression constifiable during plan-time chunk exclusion, reducing planning time and speeding up queries. This improvement is available in TimescaleDB 2.7 and will be further expanded in version 2.8 to support intervals of months and years. The optimization significantly improves query performance, with performance improvements scaling with the total number of chunks in hypertables, resulting in speeds up to 401x faster than the previous version for a total of 20,000 chunks. Users can upgrade to TimescaleDB 2.7 automatically if using Timescale Cloud or manually if self-managing their instance.