5301 Commits

Author SHA1 Message Date
Pallavi Sontakke
9ce7dc7faf
Correct syntax for setting env var 2025-02-13 15:27:43 +05:30
Pallavi Sontakke
5a936d5a87
Simplify environment variables setting 2025-02-13 12:30:47 +05:30
Sven Klemm
55fec68c17 Fix ExplainHook breaking call chain
Hooks in postgres are supposed to be chained and call the previous
hook in your own added hooks. Not calling previous hook will prevent
other extensions from having working hooks.
2025-02-12 17:10:39 +01:00
Alexander Kuzmenkov
385b36a05c
Fix the umash build (#7696)
Apparently the proper way to use the object libraries in cmake is to add
them to target_sources, not target_link_libraries.

The failing workflow:
https://github.com/timescale/timescaledb/actions/runs/13271561042/job/37052078190

Some references:
https://cprieto.com/posts/2020/06/cmake-and-object-libraries.html

https://cmake.org/pipermail/cmake/2018-June/067721.html

Disable-check: force-changelog-file
2025-02-12 13:48:53 +00:00
Mats Kindahl
e921b48f31 Revert one-reviewer rule for table access method 2025-02-12 11:18:37 +01:00
Pallavi Sontakke
ef00d9119c
Schedule coverity scan weekly on release branch.
Also, schedule sqlsmith daily on release branch.
2025-02-12 14:36:43 +05:30
Erik Nordström
7ac240080a Make VectorAgg support different child plans
Vectorized aggregation assumes that it runs on top of a
DecompressChunk child node, which makes it difficult to support other
child plans; including those that fetch data via Hypercore TAM.

Most of the DecompressChunk-specific code for planning VectorAgg
relates to identifying vectorizable columns. This code is moved to a
separate source file so that the main planning code is mostly
child-node independent.
2025-02-12 08:22:19 +01:00
Fabrízio de Royes Mello
6063464f6d Fix wrong crash error message on job history
Currently while a job is running we set `pid = SchedulerPid`,
`succeed = false` and `execution_finish=NOW()` and it leads to
confusion when querying either `timescaledb_information.job_errors`
or `timescaledb_information.job_history` views showing in the
`err_message = job crash detected, see server logs`. This information
is wrong and create confusion.

Fixed it by setting `succeed=NULL` and `pid=NULL` when the scheduler
launch the job and then when the job worker start to work then set
`pid=MyProcPid` (the worker PID) meaning that the job started and
didn't finished yet, and at the end of the execution we set
`succeed=TRUE or FALSE` and the `execution_finish=NOW()` to mark the
end of the job execution. Also adjusted the views to expose the
information properly.
2025-02-11 16:42:37 -03:00
Alexander Kuzmenkov
6ce2fc0df4
Fix vectorized hash agg in GroupAgg mode in reverse order (#7686)
The hash grouping strategies do not preserve the input order when the
compressed batches need to be reversed. Disable them in this case.
2025-02-11 16:06:57 +00:00
Mats Kindahl
d496a186d0 Restart launcher after bgw_scheduler_restart
If the scheduler is not restarted, it can affect other tests, so
restarting it at the end of the test.
2025-02-11 15:21:51 +01:00
Alexander Kuzmenkov
2d197a9572
Enable parallel index scans on compressed chunk table (#7659) 2025-02-11 12:33:10 +00:00
Sven Klemm
ab3d2471fe Release 2.18.1
This release contains performance improvements and bug fixes since
the 2.18.0 release. We recommend that you upgrade at the next
available opportunity.

**Features**
* [#7656](https://github.com/timescale/timescaledb/pull/7656) Remove limitation of compression policy for continuous aggregates

**Bugfixes**
* [#7600](https://github.com/timescale/timescaledb/pull/7600) Fix lock order when dropping index
* [#7637](https://github.com/timescale/timescaledb/pull/7637) Allow EXPLAIN in read-only mode
* [#7645](https://github.com/timescale/timescaledb/pull/7645) Fix DELETE on compressed chunk with non-btree operators
* [#7649](https://github.com/timescale/timescaledb/pull/7649) Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
* [#7653](https://github.com/timescale/timescaledb/pull/7653) Push down orderby scankeys to Hypercore TAM
* [#7665](https://github.com/timescale/timescaledb/pull/7665) Block merging of frozen chunks
* [#7673](https://github.com/timescale/timescaledb/pull/7673) Don't abort additional INSERTs when hitting first conflict

**GUCs**
* `enable_hypercore_scankey_pushdown`: Push down qualifiers as scankeys when using Hypercore TAM introduced with [#7653](https://github.com/timescale/timescaledb/pull/7653)

**Thanks**
* @bjornuppeke for reporting a problem with INSERT INTO ... ON CONFLICT DO NOTHING on compressed chunks
* @ikalafat for reporting a problem with EXPLAIN in read-only mode
* Timescale community members Jacob and pantonis for reporting issues with slow queries.
2025-02-11 10:41:16 +01:00
Pallavi Sontakke
e2d3965bb7
prerelease test on release branch: github action
---------

Signed-off-by: Pallavi Sontakke <pallavi@timescale.com>
Co-authored-by: Philip Krauss <35487337+philkra@users.noreply.github.com>
2025-02-11 10:49:11 +05:30
Sven Klemm
773ae4a833 Remove outdated references to distributed hypertables 2025-02-10 15:49:53 +01:00
Alexander Kuzmenkov
89dfbc47c5
Disambiguate the merge_append_partially_compressed test (#7658)
Make the column sets used for ordering unique, otherwise the resulting
order depends on the plan.
2025-02-10 10:55:42 +00:00
Erik Nordström
121cd82be5 Block merging of frozen chunks
It should not be possible to merge a frozen chunk since it is used to
tier chunks. If the chunk is merged, it might no longer exist when the
tiering happens.
2025-02-10 10:13:41 +01:00
Sven Klemm
41b141fae3 Don't abort additional INSERTs when hitting first conflict
When an INSERT with ON CONFLICT DO NOTHING hits the first conflicts
it would abort additional INSERTS following the INSERT triggering
the DO NOTHING clause leading to missed INSERTs.

Fixes #7672
2025-02-10 09:10:07 +01:00
Sven Klemm
89062cb94b Improve metadata for PR 7637
Since we split the fixes and thanks messages into separate sections
in the changelog the context between fix and thanks will be lost so
the thanks note should repeat any required context
2025-02-10 09:04:21 +01:00
Sven Klemm
4ffca71fc9 Remove dead is_dist_call argument from ts_hypertable_create 2025-02-10 08:19:37 +01:00
Sven Klemm
25372dc20c Fix flaky bgw scheduler test
Reconnect after adjusting configuration to ensure our session has
it applied.
2025-02-08 00:03:01 +01:00
Sven Klemm
4fa5cf1d3e Adjust windows package test CI
Since we depend on the openssl version of the postgres installer
to match the openssl version we built against and we can't ensure
stability of that version in the postgres installer we only test
windows package against the latest available postgres version.
2025-02-07 23:50:12 +01:00
Erik Nordström
cde81858e8 Fix backwards scan on Hypercore TAM
Fix a bug when backwards scanning a ColumnarScan and add a test case.
2025-02-07 10:24:20 +01:00
Erik Nordström
8cff1c22a1 Optimize quals on segmentby columns in ColumnarScan
When filtering arrow slots in ColumnarScan, quals on segmentby columns
should be executed separately from those on other columns because they
don't require decompression and might filter the whole arrow slot in
one go. Furthermore, the quals only need to be applied once per arrow
slot since the segmentby value is the same for all compressed rows in
the slot.

This will speed up scans when filters on segmentby columns cannot be
pushed down to Hypercore TAM as scankeys. For example, "<column> IN
(1, 2, 3)" won't be pushed down as a scankey because only index scans
support scankeys with such scalar array expressions.
2025-02-07 10:24:20 +01:00
Rob Kiefer
30b47b894b Remove limitation of compression policy for continuous aggregates
Before compressed chunks were mutable, adding a compression policy
to a continuous aggregate that could include portions of the refrsh
window were blocked. When a continuous aggregate is refreshed, the
underlying chunks needed to allow DELETEs and INSERTs, so they
could not be compressed. Now, compressed chunks allow both operations
and there is no longer a need to prevent the refresh window and
compression window from overlapping.
2025-02-05 17:06:25 -05:00
Erik Nordström
d0c2bb722b Push down orderby scankeys to Hypercore TAM
Quals on orderby columns can be pushed down to Hypercore TAM and be
transformed to the corresponding min/max scankeys on the compressed
relation. Previously, only quals on non-compressed segmentby columns
were pushed down as scankeys.

Pushing down orderby scan keys seem to give a good performance boost
for columnar scans when no index exists.

The scankey push down can be disabled with a new GUC:

`timescaledb.enable_hypercore_scankey_pushdown=false`
2025-02-05 14:38:53 +01:00
Alexander Kuzmenkov
0eadff3bee
Update existing backports in the backport script (#7612)
Depending on the branch protection settings, we might have to update
them before they can be merged, so do this automatically to minimize the
required manual work.
2025-02-05 13:10:36 +00:00
Alexander Kuzmenkov
d28224307a
Optimize decompression planning (#7568)
The EquivalenceMember lookup is the most costly part, so share it
between different uses.

Switch batch sorted merge to use the generic pathkey matching code.

Also cache some intermediate data in the CompressionInfo struct.
2025-02-05 10:00:36 +00:00
Sven Klemm
1c1743d67a Allow non-btree operator pushdown in UPDATE/DELETE queries on compressed chunks
When pushing down expressions into the compressed scan we assumed
all valid expressions use btree operators and dropped any that weren't.
This patch changes the behaviour to keep those expressions and use
them as heap filter on the compressed scan for UPDATE and DELETE
on compressed chunks.
2025-02-04 17:32:31 +01:00
Erik Nordström
4ddf002a3b Prepare VectorAgg exec path to handle arrow slots
The VectorAgg exec loop reads tuples directly from a compressed
relation, thus bypassing the DecompressChunk child node. This won't
work with arrow slots, which are read via a table access method.

To make the VectorAgg exec code similar to the standard pattern of
reading slots from child nodes, code specific to decompressing batches
is moved out of the main VectorAgg exec loop so that the loop only
deals with the final compressed batch slot instead of the raw
compressed slot. The code is instead put in a "get_next_slot"
function, which is called from the loop.

Also move the code to initialize vectorized filters to its own
"init_vector_qual" function, since it is specific to compressed
batches.

With these two function interfaces, it is possible to provide
implementations of the functions for handling arrow slots.
2025-02-04 15:49:39 +01:00
Alexander Kuzmenkov
db5e246551
Vector agg: skip entire null words of filter bitmap (#7569)
This improves the performance for highly selective filters.
2025-02-03 16:03:20 +00:00
Sven Klemm
0510b5d753 Sync sql/updates/2.18.0--2.17.2.sql with release branch
The downgrade script for 2.17.2 that was merged into main branch
was different from the one in 2.18.0 due to merge error. This
patch syncs the downgrade script with the version used in 2.18.0
release.
2025-02-03 16:35:46 +01:00
Alexander Kuzmenkov
caa656812b
Store hash value in hash table in dictionary compressor (#7642)
This speeds up the compression. The recompression of the hackers mailing list archive is now almost 40%
faster.
2025-02-03 14:49:31 +00:00
Sven Klemm
253a7cbcb8 Fix DELETE on compressed chunk with non-btree operators
When deleting from compressed chunk the direct delete optimization
would ignore constraints that were not using btree operators
leading to constraints of the DELETE not being applied to the
direct delete on the compressed chunk, potentially leading to
data corruption. This patch disables the direct delete optimization
when any of the constraints can not be applied.

Fixes #7644
2025-02-03 13:11:32 +01:00
Pallavi Sontakke
c01ad1748e
Automate Minor release - Feature Freeze
with GitHub workflow files.

We run these steps for a new minor version - feature freeze :
- create the Bump-version PR on `main`, 
- create the new minor-version-branch , e.g. `2.18.x`
- create the Release PR on minor-version-branch

We no more use a fork, but a branch directly.
2025-02-03 11:35:14 +05:30
Mats Kindahl
39049feba6 Allow EXPLAIN in read-only mode
Using `EXPLAIN` when `transaction_read_only` is set to `on` fails with
an error. This is fixed by explicitly setting the `check_read_only`
flag.
2025-01-31 14:06:17 +01:00
Sven Klemm
65b8151af3 Add actionable hints to update script checker 2025-01-31 11:36:21 +01:00
Erik Nordström
64e5ffceb7 Refactor VectorAgg to use TupleTableSlot interface
To support VectorAgg on top of Hypercore TAM, change the vector agg
processing functions to pass around tuple table slots instead of
compressed batches. This makes it possible to pass any "compatible"
"vector slot" to the vector agg functions, which is required since TAM
uses a slightly different slot implementation for arrow/vector data.

In addition, add some functions to handle reading vector data from
compatible vector slot implementations. This commit only adds the code
to read from compressed batches. Arrow slots will be supported as part
of a later change.
2025-01-30 16:43:58 +01:00
Mats Kindahl
538c4430e7 Fix lock order when dropping index
If an index is dropped, it is necessary to lock the heap table (of
the index) before the index since all normal operations do it in this
order. When dropping an index, we did not take all the necessary locks
in the right order before calling `performMultipleDeletions`, which can
cause deadlocks when dropping an index on a hypertable at the same time
as running a utility statement that takes heavy locks, e.g., VACUUM or
ANALYZE.

Adding a isolation test as well that will generate a deadlock if the
index and table locks are not taken in the correct order.
2025-01-30 13:42:57 +01:00
Fabrízio de Royes Mello
06ccc50674 Update gitignore
Leftover from dc671301
2025-01-28 22:50:46 -03:00
Sven Klemm
8479ba738a Remove some dead code from downgrade script generation
Since we only support generating downgrade script for the previous
version anything targeting versions before 2.18 will never be
executed in current context. So we can safely remove the code that
deals with version before 2.3.
2025-01-27 13:11:21 +01:00
Sven Klemm
e9da072f87 Add ci check for idempotency in sql scripts
To detect the problematic patterns that were part of the 2.18 release
we can check the sql scripts against a list of allowed statements.
Any non idempotent operation should be in the pre_install scripts
and not the scripts that get appended for the update scripts.
2025-01-27 12:26:40 +01:00
Ante Kresic
f35930b822 Add Windows package test for latest pg17 2025-01-27 11:59:25 +01:00
Sven Klemm
2194a6109f Allow more workflows to be triggered by github ui
This is mostly to allow triggering package tests directly from
github UI but no harm enabling it for a couple more.
2025-01-24 22:47:16 +01:00
Sven Klemm
2c52b54724 Fix downgrade path for 2.18.0
This patch adjusts the downgrade script generation to not include
incompatible files from the 2.18.0 release that would break script
generation and replaces them with a working version. This adjustment
can be removed after we release of 2.18.1.
This patch also reenables the downgrade test.
2025-01-24 19:51:06 +01:00
Alexander Kuzmenkov
2b0011e7e8
Import the UMASH hashing library (#7616)
We use it for vectorized hash grouping. For now, add the library
separately to figure out the required CMake and CI changes.
2025-01-24 14:45:05 +00:00
Sven Klemm
5c2f6b5bc5 Temporarily disable downgrade test
The 2.18.0 sql files for building downgrade scripts have some
incompatible changes in them that prevent downgrade script generation.
This patch disable downgrade test until the necessary adjustments
in downgrade script generation are made.
2025-01-24 13:10:21 +01:00
Pallavi Sontakke
2b2d02fa27 Release 2.18.0
This release introduces the ability to add secondary indexes to the columnstore, improves group by and filtering performance through columnstore vectorization, and contains the highly upvoted community request of transition table support. We recommend that you upgrade at the next available opportunity.

**Highlighted features in TimescaleDB v2.18.0**

* The ability to add secondary indexes to the columnstore through the new hypercore table access method.
* Significant performance improvements through vectorization (`SIMD`) for aggregations using a group by with one column and/or using a filter clause when querying the columnstore.
* Hypertables support triggers for transition tables, which is one of the most upvoted community feature requests.
* Updated methods to manage Timescale's hybrid row-columnar store (hypercore) that highlight the usage of the columnstore which includes both an optimized columnar format as well as compression.

**Dropping support for Bitnami images**

After the recent change in Bitnami’s [LTS support policy](https://github.com/bitnami/containers/issues/75671), we are no longer building Bitnami images for TimescaleDB. We recommend using the [official TimescaleDB Docker image](https://hub.docker.com/r/timescale/timescaledb-ha)

**Deprecation Notice**

We are deprecating the following parameters, functions, procedures and views. They will be removed with the next major release of TimescaleDB. Please find the replacements in the table below:

| Deprecated | Replacement | Type |
| --- | --- | --- |
| decompress_chunk | convert_to_rowstore | Procedure |
| compress_chunk | convert_to_columnstore | Procedure |
| add_compression_policy | add_columnstore_policy | Function |
| remove_compression_policy | remove_columnstore_policy | Function |
| hypertable_compression_stats | hypertable_columnstore_stats | Function |
| chunk_compression_stats | chunk_columnstore_stats | Function |
| hypertable_compression_settings | hypertable_columnstore_settings | View |
| chunk_compression_settings | chunk_columnstore_settings | View |
| compression_settings | columnstore_settings | View |
| timescaledb.compress | timescaledb.enable_columnstore | Parameter |
| timescaledb.compress_segmentby | timescaledb.segmentby | Parameter |
| timescaledb.compress_orderby  | timescaledb.orderby | Parameter |

**Features**
* #7341: Vectorized aggregation with grouping by one fixed-size by-value compressed column (such as arithmetic types).
* #7104: Hypercore table access method.
* #6901: Add hypertable support for transition tables.
* #7482: Optimize recompression of partially compressed chunks.
* #7458: Support vectorized aggregation with aggregate `filter` clauses that are also vectorizable.
* #7433: Add support for merging chunks.
* #7271: Push down `order by` in real-time continuous aggregate queries.
* #7455: Support `drop not null` on compressed hypertables.
* #7295: Support `alter table set access method` on hypertable.
* #7411: Change parameter name to enable hypercore table access method.
* #7436: Add index creation on `order by` columns.
* #7443: Add hypercore function and view aliases.
* #7521: Add optional `force` argument to `refresh_continuous_aggregate`.
* #7528: Transform sorting on `time_bucket` to sorting on time for compressed chunks in some cases.
* #7565: Add hint when hypertable creation fails.
* #7390: Disable custom `hashagg` planner code.
* #7587: Add `include_tiered_data` parameter to `add_continuous_aggregate_policy` API.
* #7486: Prevent building against PostgreSQL versions with broken ABI.
* #7412: Add [GUC](https://www.postgresql.org/docs/current/acronyms.html#:~:text=GUC) for the `hypercore_use_access_method` default.
* #7413: Add GUC for segmentwise recompression.

**Bugfixes**
* #7378: Remove obsolete job referencing `policy_job_error_retention`.
* #7409: Update `bgw_job` table when altering procedure.
* #7410: Fix the `aggregated compressed column not found` error on aggregation query.
* #7426: Fix `datetime` parsing error in chunk constraint creation.
* #7432: Verify that the heap tuple is valid before using.
* #7434: Fix the segfault when internally setting the replica identity for a given chunk.
* #7488: Emit error for transition table trigger on chunks.
* #7514: Fix the error: `invalid child of chunk append`.
* #7517: Fix the performance regression on the `cagg_migrate` procedure.
* #7527: Restart scheduler on error.
* #7557: Fix null handling for in-memory tuple filtering.
* #7566: Improve transaction check in CAGG refresh.
* #7584: Fix NaN-handling for vectorized aggregation.
* #7598: Match the Postgres NaN comparison behavior in WHERE clause over compressed tables.

**Thanks**
* @bharrisau for reporting the segfault when creating chunks.
* @jakehedlund for reporting the incompatible NaN behavior in WHERE clause over compressed tables.
* @k-rus for suggesting that we add a hint when hypertable creation fails.
* @staticlibs for sending the pull request that improves the transaction check in CAGG refresh.
* @uasiddiqi for reporting the `aggregated compressed column not found` error.
2025-01-24 13:10:21 +01:00
Sven Klemm
dc67130185 Fix TAM handling in update script
The TAM SQL code was not written with update and downgrade scripts
in mind prevents further releases past 2.18.0 due to not splitting
up the parts that need to be part of every update script and those
that can only run once during initial installation.
2025-01-24 01:29:07 +01:00
Sven Klemm
79418787b8 Allow table_am_handler and index_am_handler C function references
We need to allow these in the update script as we try to create
an operator class later that is gonna call those functions during
upgrade process.
2025-01-24 01:29:07 +01:00
Erik Nordström
b2d6612e81 Refactor vector qual handling for arrow slots
Move the code for vector qual execution to its own module. The vector
qual execution will produce a result in the form of a bitmap filter
for the arrow array. Add functions to the arrow slot to carry the
result bitmap in the arrow tuple table slot. This allows passing the
filter result to nodes above the node that computed the vector qual
result. This is necessary to, e.g., run vectorized aggregation above a
columnar scan.
2025-01-23 17:38:21 +01:00