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

Merge acts_as_timevector back into acts_as_hypertable metadata #78

Open
jonatas opened this issue Nov 21, 2024 · 0 comments
Open

Merge acts_as_timevector back into acts_as_hypertable metadata #78

jonatas opened this issue Nov 21, 2024 · 0 comments

Comments

@jonatas
Copy link
Collaborator

jonatas commented Nov 21, 2024

acts_as_timevector serves as a base to store the segment_by.

Options:

  1. Load it directly from compression settings.
  2. Explicit it directly in the model independent of compression, just for the sake of leveraging scopes.

Make it explicit to guarantee versions are build accordingly to the explicit code. If compression settings change in the database, we cannot rely on it.

Example of code:

    class PageLoad < ApplicationRecord
      acts_as_hypertable chunk_time_interval: '1 day',
        time_column: 'created_at'

      acts_as_timevector segment_by: 'path'

      scope :stats, -> do 
        select('max(performance), min(performance), avg(performance)')
      end

      continuous_aggregates :stats, timeframes: ['1 hour', '1 day']
    end

vs

    class PageLoad < ApplicationRecord
      acts_as_hypertable chunk_time_interval: '1 day',
        time_column: 'created_at', segment_by: 'path'

      scope :stats, -> do 
        select('max(performance), min(performance), avg(performance)')
      end

      continuous_aggregates :stats, timeframes: ['1 hour', '1 day']
    end
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

No branches or pull requests

1 participant