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
Introduce experimental time_bucket_ng() function #3211
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3211 +/- ##
=======================================
Coverage 90.61% 90.61%
=======================================
Files 211 212 +1
Lines 35536 35588 +52
=======================================
+ Hits 32200 32249 +49
- Misses 3336 3339 +3
Continue to review full report at Codecov.
|
8298aaf
to
6196c8d
Compare
@afiskon, Hello! |
@binakot Many users requested time_bucket but with the support of variable-sized buckets (e.g. months) or timezones and we try our best to provide this functionality. At this point, ts_date_trunc() is just an extended version of date_trunc(). You can do something like ts_date_trunc('1 year 3 months', ...) which can't be done with date_trunc(). The main difference from time_bucket() is that time_bucket() always works with fixed-sized buckets (hours, days, ...) and thus can be used in continuous aggregates. This PR is a kind of work in progress. We experiment with the code, gather feedback, and see what can be done next. |
1f8bc01
to
dfdd92a
Compare
92c6525
to
1ce41bb
Compare
b255456
to
c06bdd1
Compare
I don't quite like the heavy use of I think we could achieve the same overhead as the macros by using |
@erimatnor Many thanks for the review! This is a good question. I think I answered this on a standup, but apparently on the one where not the entire team was present. My bad. This is not the final version of the implementation. My current goal is to make the following query work properly:
Then I will cover it with tests and submit another PR. Now we have experimental support of 1-month buckets. The next step is to make N-month buckets work. Same idea - separate tests, separate PR, separate review, and we have experimental support of N-month buckets. Then we can work on years - '1 year' buckets first, then '1 year, 3 months' and more complicated scenarios. Separate tests, separate code reviews, etc. Then we can start working for instance on timezones. Days and hours can be added at any time since we already know they work. We just don't need to support (+ test, review) them in time_bucket_ng at the moment. So the general idea is to decompose the large task, add the feature in incremental steps. Starting from the parts where there are the most unknowns, and thus where the risks are higher. |
@mfundul Many thanks for the review. @erimatnor didn't like these calls as well but for different reasons. As I explained above #3211 (comment) we will not keep this code forever. There will be no DirectFunctionCallX in the final implementation. Please see the full reply. |
ab926b3
to
18e5058
Compare
I am not following the connection to continuous aggregates here. If we are removing limitations in the cagg implementation, we could just use, e.g., |
60f6d72
to
05b68f3
Compare
This patch adds time_bucket_ng() function to the experimental schema. The "ng" part stands for "next generation". Unlike current time_bucket() implementation the _ng version will support months, years and timezones. Current implementation doesn't claim to be complete. For instance, it doesn't support timezones yet. The reasons to commit it in it's current state are 1) to shorten the feedback loop 2) to start experimenting with monthly buckets are soon as possible, 3) to reduce the unnecessary work of rebasing and resolving conflicts 4) to make the work easier to the reviewers
05b68f3
to
c815cb2
Compare
@erimatnor Unfortunately, we can't use date_trunc in the general case because it doesn't support things like '5 months' and/or |
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. For this reason, from TimescaleDB 2.4 onwards PostgreSQL 12 or 13 are required. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. For this reason, from TimescaleDB 2.4 onwards PostgreSQL 12 or 13 are required. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. For this reason, from TimescaleDB 2.4 onwards PostgreSQL 12 or 13 are required. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng * timescale#3446 Implement cleanup for chunk copy/move. **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng * timescale#3446 Implement cleanup for chunk copy/move. **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng * timescale#3446 Implement cleanup for chunk copy/move. **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * timescale#3293 Add timescaledb_experimental schema * timescale#3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * timescale#3211 Introduce experimental time_bucket_ng function * timescale#3366 Allow use of experimental time_bucket_ng function in continuous aggregates * timescale#3408 Support for seconds, minutes and hours in time_bucket_ng * timescale#3446 Implement cleanup for chunk copy/move. **Bugfixes** * timescale#3401 Fix segfault for RelOptInfo without fdw_private * timescale#3411 Verify compressed chunk validity for compressed path * timescale#3416 Fix targetlist names for continuous aggregate views * timescale#3434 Remove extension check from relcache invalidation callback * timescale#3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * #3293 Add timescaledb_experimental schema * #3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * #3211 Introduce experimental time_bucket_ng function * #3366 Allow use of experimental time_bucket_ng function in continuous aggregates * #3408 Support for seconds, minutes and hours in time_bucket_ng * #3446 Implement cleanup for chunk copy/move. **Bugfixes** * #3401 Fix segfault for RelOptInfo without fdw_private * #3411 Verify compressed chunk validity for compressed path * #3416 Fix targetlist names for continuous aggregate views * #3434 Remove extension check from relcache invalidation callback * #3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
This release adds new experimental features since the 2.3.1 release. The experimental features in this release are: * APIs for chunk manipulation across data nodes in a distributed hypertable setup. This includes the ability to add a data node and move chunks to the new data node for cluster rebalancing. * The `time_bucket_ng` function, a newer version of `time_bucket`. This function supports years, months, days, hours, minutes, and seconds. We’re committed to developing these experiments, giving the community a chance to provide early feedback and influence the direction of TimescaleDB’s development. We’ll travel faster with your input! Please create your feedback as a GitHub issue (using the experimental-schema label), describe what you found, and tell us the steps or share the code snip to recreate it. This release also includes several bug fixes. PostgreSQL 11 deprecation announcement Timescale is working hard on our next exciting features. To make that possible, we require functionality that is available in Postgres 12 and above. Postgres 11 is not supported with TimescaleDB 2.4. **Experimental Features** * #3293 Add timescaledb_experimental schema * #3302 Add block_new_chunks and allow_new_chunks API to experimental schema. Add chunk based refresh_continuous_aggregate. * #3211 Introduce experimental time_bucket_ng function * #3366 Allow use of experimental time_bucket_ng function in continuous aggregates * #3408 Support for seconds, minutes and hours in time_bucket_ng * #3446 Implement cleanup for chunk copy/move. **Bugfixes** * #3401 Fix segfault for RelOptInfo without fdw_private * #3411 Verify compressed chunk validity for compressed path * #3416 Fix targetlist names for continuous aggregate views * #3434 Remove extension check from relcache invalidation callback * #3440 Fix remote_tx_heal_data_node to work with only current database **Thanks** * @fvannee for reporting an issue with hypertable expansion in functions * @amalek215 for reporting an issue with cache invalidation during pg_class vacuum full * @hardikm10 for reporting an issue with inserting into compressed chunks * @dberardo-com and @iancmcc for reporting an issue with extension updates after renaming columns of continuous aggregates.
See also #3211 (comment)