Class: Timescaledb::Hypertable
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Timescaledb::Hypertable
- Defined in:
- lib/timescaledb/hypertable.rb
Instance Method Summary collapse
- #after_total_bytes ⇒ Object
- #approximate_row_count ⇒ Object
- #before_total_bytes ⇒ Object
- #chunks_detailed_size ⇒ Object
- #compression_stats ⇒ Object
- #detailed_size ⇒ Object
- #main_dimension ⇒ Object
Instance Method Details
#after_total_bytes ⇒ Object
46 47 48 |
# File 'lib/timescaledb/hypertable.rb', line 46 def after_total_bytes compression_stats["after_compression_total_bytes"] || 0 end |
#approximate_row_count ⇒ Object
29 30 31 |
# File 'lib/timescaledb/hypertable.rb', line 29 def approximate_row_count struct_from("SELECT * FROM approximate_row_count('#{self.hypertable_name}')").first.approximate_row_count end |
#before_total_bytes ⇒ Object
42 43 44 |
# File 'lib/timescaledb/hypertable.rb', line 42 def before_total_bytes compression_stats["before_compression_total_bytes"] || detailed_size.total_bytes end |
#chunks_detailed_size ⇒ Object
25 26 27 |
# File 'lib/timescaledb/hypertable.rb', line 25 def chunks_detailed_size struct_from "SELECT * from chunks_detailed_size('#{self.hypertable_name}')" end |
#compression_stats ⇒ Object
33 34 35 36 |
# File 'lib/timescaledb/hypertable.rb', line 33 def compression_stats @compression_stats ||= struct_from("SELECT * from hypertable_compression_stats('#{self.hypertable_name}')").first || {} end |
#detailed_size ⇒ Object
38 39 40 |
# File 'lib/timescaledb/hypertable.rb', line 38 def detailed_size struct_from("SELECT * FROM hypertable_detailed_size('#{self.hypertable_name}')").first end |
#main_dimension ⇒ Object
21 22 23 |
# File 'lib/timescaledb/hypertable.rb', line 21 def main_dimension dimensions.find_by dimension_number: 1 end |