timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.8k stars 852 forks source link

Relax some JOIN restrictions on CAggs #7032

Open fabriziomello opened 2 weeks ago

fabriziomello commented 2 weeks ago

Relax JOIN restrictions on CAggs by allowing

Closes #1446, #1516, #1717, #2400, #3314, #4088

Disable-check: force-changelog-file

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.76%. Comparing base (59f50f2) to head (6e72d99). Report is 230 commits behind head on main.

Files Patch % Lines
tsl/src/continuous_aggs/common.c 81.81% 0 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7032 +/- ## ========================================== + Coverage 80.06% 81.76% +1.69% ========================================== Files 190 200 +10 Lines 37181 37304 +123 Branches 9450 9721 +271 ========================================== + Hits 29770 30502 +732 + Misses 2997 2896 -101 + Partials 4414 3906 -508 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

svenklemm commented 2 weeks ago

Why are we not just allowing this?

fabriziomello commented 2 weeks ago

Why are we not just allowing this?

We will and it will be part of Q3, but for now I just want make sure it will not segfault.

fabriziomello commented 1 week ago

Could you please describe why the segfault occurs and how it was fixed in the commit comment?

Done!

fabriziomello commented 1 week ago

Still segfaults with following query: CREATE MATERIALIZED VIEW cagg1 with(timescaledb.continuous) as select time_bucket('1d',time) from metrics m1 join metrics m2 using(time) join metrics m3 using(time) group by 1;

Actually it is failing on main with my patch is even works... it is allowing it :-(

151388 (leader) fabrizio=# CREATE MATERIALIZED VIEW cagg1 with(timescaledb.continuous) as select time_bucket('1d',time) from metrics m1 join metrics m2 using(time) join metrics m3 using(time) group by 1;
NOTICE:  00000: continuous aggregate "cagg1" is already up-to-date
LOCATION:  emit_up_to_date_notice, refresh.c:674
CREATE MATERIALIZED VIEW
Time: 32,843 ms
fabriziomello commented 1 week ago

@svenklemm I'll rewrite all this messy join validation... it can be way simpler!!!

svenklemm commented 1 week ago

It probably takes the same amount of time to change the code to allow it, so why not just do that?