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

Sort continuous aggregates when dumping to the schema #71

Closed

Conversation

carlosantoniodasilva
Copy link

Makes the schema dumper output consistent by sorting the continuous aggregates by the view name, otherwise the schema can get a random diff depending on the rows order returned by the DB.

> Timescaledb::ContinuousAggregates.order(:view_name).pluck(:view_name)
  Timescaledb::ContinuousAggregate Pluck (5.9ms)  SELECT "timescaledb_information"."continuous_aggregates"."view_name" FROM "timescaledb_information"."continuous_aggregates" ORDER BY "timescaledb_information"."continuous_aggregates"."view_name" ASC

The hypertables (and the retention policies which are based on them) are already sorted and create a consistent schema output.

Makes the schema dumper output consistent by sorting the continuous aggregates by the view name, otherwise the schema can get a random diff depending on the rows order returned by the DB.

```
> Timescaledb::ContinuousAggregates.order(:view_name).pluck(:view_name)
  Timescaledb::ContinuousAggregate Pluck (5.9ms)  SELECT "timescaledb_information"."continuous_aggregates"."view_name" FROM "timescaledb_information"."continuous_aggregates" ORDER BY "timescaledb_information"."continuous_aggregates"."view_name" ASC
```
@jonatas
Copy link
Owner

jonatas commented Sep 6, 2024

Hi @carlosantoniodasilva, thank you very much for your contribution. It will not be simple as that because of the dependencies. I have already the PR open and forgot to push it forward and merge it.

Check #70 for understanding the real issue. I'll make sure I include your consideration of also sorting by view name as you did it. Will push it forward soon 🤞

@carlosantoniodasilva
Copy link
Author

Cool, appreciate it @jonatas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants