Read hypertable max time value with an ordered scan - #10379
Conversation
|
@akuzm, @antekresic: please review this pull request.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
1c6895b to
4c5077b
Compare
akuzm
left a comment
There was a problem hiding this comment.
I think this change is good by itself, because the plan for min/max is going to be like this in any case, only here we skip an extra rewrite that would be done in build_minmax_path. But does this mean that sort pushdown doesn't work for this extract function? We're going to run into other performance problems then, and it makes sense to double-check this.
For ordering you dont need the extract function. Dont think we optimize extract function by itself atm. But outside scope of this PR |
The max value of a hypertable's open dimension was read with a max() aggregate. For UUID time columns the aggregate argument is an expression that extracts the timestamp from the UUID. Because the argument is an expression and not a plain column, the planner cannot rewrite the aggregate into a min/max aggregate, so it reads every row instead. Also lock down search_path for the SPI execution and fix a sql injection vulnerability in the UUID path.
4c5077b to
c59a331
Compare
# TimescaleDB Changelog **Please note: When updating your database, you should connect using `psql` with the `-X` flag to prevent any `.psqlrc` commands from accidentally triggering the load of a previous TimescaleDB version.** ## 2.29.1 (2026-08-04) This release contains performance improvements and bug fixes since the 2.29.0 release and fixes for security vulnerabilities (#10360, #10379, #10386). You can check the [security advisory](https://github.com/timescale/timescaledb/security/advisories/GHSA-hcfx-29v5-2rcw) for more information on the vulnerability and the platforms that are affected. We recommend that you upgrade at the next available opportunity. **Bugfixes** * [#10327](#10327) Assertion failure in `add_dimension()` when the hypertable argument is `NULL` * [#10339](#10339) Fix crash when deleting from a compressed continuous aggregate source * [#10340](#10340) Validate `max_batches` in `compact_chunk()` * [#10352](#10352) Reset inherited column and constraint flags on chunks during `attach_chunk()` * [#10360](#10360) Fix decompressor crashes with malformed compressed data * [#10369](#10369) Fix typo in error message about `MERGE` support on compressed hypertables * [#10379](#10379) Read hypertable max time value with an ordered scan * [#10386](#10386) Add missing permission checks to internal chunk functions **Thanks** * @JoongHyuk-Shin for reporting and fixing `NULL` handling in `add_dimension()` * @igor2x for reporting a typo in a `MERGE` support error message * @mdisec for reporting issues with compressed data validation during decompression
The max value of a hypertable's open dimension was read with a max()
aggregate. For UUID time columns the aggregate argument is an expression
that extracts the timestamp from the UUID. Because the argument is an
expression and not a plain column, the planner cannot rewrite the
aggregate into a min/max aggregate, so it reads every row instead.
Also lock down search_path for the SPI execution and fix a sql
injection vulnerability in the UUID path.