Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enabling compression on continuous aggregates with columns requiring quotation #5290

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

kgyrtkirk
Copy link
Contributor

consider the sql commands:

drop table if EXISTS "tEst2" ;
-- Creating hypertable
CREATE TABLE IF NOT EXISTS "tEst2" (
    "Id" uuid NOT NULL,
    "Time" timestamp with time zone NOT NULL,
    CONSTRAINT "test2_pkey" PRIMARY KEY ("Id", "Time")
);

SELECT create_hypertable(
  '"tEst2"',
  'Time',
  chunk_time_interval => INTERVAL '1 day'
);

alter table "tEst2" set (timescaledb.compress=true, timescaledb.compress_segmentby='"Id"');

DROP MATERIALIZED VIEW if EXISTS "tEst2_mv";

CREATE MATERIALIZED VIEW "tEst2_mv"
WITH (timescaledb.continuous) AS
SELECT "Id" as "Idd",
   time_bucket(INTERVAL '1 day', "Time") AS "bUcket"
FROM public."tEst2" 
GROUP BY "Idd", "bUcket";

ALTER MATERIALIZED VIEW "tEst2_mv" SET (timescaledb.compress = true);

before this patch the last command failed because:

  • the Idd column lost quotation; leading to ERROR: column "idd" does not exist
  • or the bUcket column lost quotation; leading to ERROR: column "bucket" does not exist

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

@mahipv, @akuzm: please review this pull request.

Powered by pull-review

@kgyrtkirk kgyrtkirk requested a review from mkindahl February 6, 2023 16:57
Copy link
Member

@svenklemm svenklemm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing DROP IF EXISTS is not necessary in tests since they each run in dedicated databases

@kgyrtkirk
Copy link
Contributor Author

@svenklemm done

@kgyrtkirk kgyrtkirk force-pushed the mv-auto-segmentby-quotation branch from bbf3121 to 738048c Compare February 7, 2023 10:02
@kgyrtkirk kgyrtkirk requested a review from svenklemm February 7, 2023 10:02
@kgyrtkirk kgyrtkirk force-pushed the mv-auto-segmentby-quotation branch from 738048c to ae8522f Compare February 7, 2023 10:04
@codecov
Copy link

codecov bot commented Feb 7, 2023

Codecov Report

Merging #5290 (5b8c4c4) into main (4cb76bc) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5290      +/-   ##
==========================================
- Coverage   89.34%   89.33%   -0.01%     
==========================================
  Files         225      225              
  Lines       51924    51913      -11     
==========================================
- Hits        46390    46375      -15     
- Misses       5534     5538       +4     
Impacted Files Coverage Δ
tsl/src/continuous_aggs/options.c 95.79% <100.00%> (+0.44%) ⬆️
src/loader/bgw_message_queue.c 86.36% <0.00%> (-2.28%) ⬇️
src/bgw/scheduler.c 83.63% <0.00%> (-0.26%) ⬇️
tsl/src/bgw_policy/job.c 87.45% <0.00%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cb76bc...5b8c4c4. Read the comment docs.

The continuous aggregate creation failed in case segmentby/orderby
columns needed quotation.
@kgyrtkirk kgyrtkirk force-pushed the mv-auto-segmentby-quotation branch from ae8522f to 5b8c4c4 Compare February 7, 2023 12:54
@kgyrtkirk kgyrtkirk changed the title Compression can't be enabled on MVs when segmentby/orderby columns need quotation Compression can't be enabled on continous aggregates when segmentby/orderby columns need quotation Feb 7, 2023
@kgyrtkirk kgyrtkirk added the bug label Feb 7, 2023
@svenklemm svenklemm changed the title Compression can't be enabled on continous aggregates when segmentby/orderby columns need quotation Compression can't be enabled on continuous aggregates when segmentby/orderby columns need quotation Feb 7, 2023
@kgyrtkirk kgyrtkirk enabled auto-merge (rebase) February 7, 2023 19:56
@kgyrtkirk kgyrtkirk merged commit cad2440 into timescale:main Feb 7, 2023
@mahipv mahipv mentioned this pull request Feb 14, 2023
@svenklemm svenklemm changed the title Compression can't be enabled on continuous aggregates when segmentby/orderby columns need quotation Fix enabling compression on continuous aggregates with columns requiring quotation Feb 15, 2023
mahipv added a commit that referenced this pull request Feb 20, 2023
This release contains new features and bug fixes since the 2.9.3
release.

This release is high priority for upgrade. We strongly recommend that
you upgrade as soon as possible.

**Features**
* #5241 Allow RETURNING clause when inserting into compressed chunks
* #5245 Manage life-cycle of connections via memory contexts
* #5246 Make connection establishment interruptible
* #5253 Make data node command execution interruptible
* #5243 Enable real-time aggregation for continuous aggregates with
joins
* #5262 Extend enabling compression on a continuous aggregrate with
'compress_segmentby' and 'compress_orderby' parameters

**Bugfixes**
* #4926 Fix corruption when inserting into compressed chunks
* #5218 Add role-level security to job error log
* #5214 Fix use of prepared statement in async module
* #5290 Compression can't be enabled on continuous aggregates when
segmentby/orderby columns need quotation
* #5239 Fix next_start calculation for fixed schedules
mahipv pushed a commit that referenced this pull request Feb 21, 2023
This release contains new features and bug fixes since the 2.9.3 release.
We deem it moderate priority for upgrading.

This release includes these noteworthy features:
* Joins in continuous aggregates
* Re-architecture of how compression works: ~2x improvement on INSERT rate into compressed chunks.
* Full PostgreSQL 15 support for all existing features. Support for the newly introduced MERGE command on hypertables will be introduced on a follow-up release.

**PostgreSQL 12 deprecation announcement**
We will continue supporting PostgreSQL 12 until July 2023. Sooner to that time, we will announce the specific version of TimescaleDB in which PostgreSQL 12 support will not be included going forward.

**Old format of Continuous Aggregates deprecation announcement**
TimescaleDB 2.7 introduced a new format for continuous aggregates that improves performance.
All instances with Continuous Aggregates using the old format should [migrate to the new format](https://docs.timescale.com/api/latest/continuous-aggregates/cagg_migrate/) by July 2023,
when support for the old format will be removed.
Sooner to that time, we will announce the specific version of TimescaleDB in which support for this feature will not be included going forward.

**Features**
* #4874 Allow joins in continuous aggregates
* #4926 Refactor INSERT into compressed chunks
* #5241 Allow RETURNING clause when inserting into compressed chunks
* #5245 Manage life-cycle of connections via memory contexts
* #5246 Make connection establishment interruptible
* #5253 Make data node command execution interruptible
* #5262 Extend enabling compression on a continuous aggregrate with 'compress_segmentby' and 'compress_orderby' parameters

**Bugfixes**
* #5214 Fix use of prepared statement in async module
* #5218 Add role-level security to job error log
* #5239 Fix next_start calculation for fixed schedules
* #5290 Fix enabling compression on continuous aggregates with columns requiring quotation

**Thanks**
* @henriquegelio for reporting the issue on fixed schedules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants