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
48 49 50 |
# File 'lib/timescaledb/hypertable.rb', line 48 def after_total_bytes compression_stats["after_compression_total_bytes"] || 0 end |
#approximate_row_count ⇒ Object
31 32 33 |
# File 'lib/timescaledb/hypertable.rb', line 31 def approximate_row_count struct_from("SELECT * FROM approximate_row_count('#{self.hypertable_name}')").first.approximate_row_count end |
#before_total_bytes ⇒ Object
44 45 46 |
# File 'lib/timescaledb/hypertable.rb', line 44 def before_total_bytes compression_stats["before_compression_total_bytes"] || detailed_size.total_bytes end |
#chunks_detailed_size ⇒ Object
27 28 29 |
# File 'lib/timescaledb/hypertable.rb', line 27 def chunks_detailed_size struct_from "SELECT * from chunks_detailed_size('#{self.hypertable_name}')" end |
#compression_stats ⇒ Object
35 36 37 38 |
# File 'lib/timescaledb/hypertable.rb', line 35 def compression_stats @compression_stats ||= struct_from("SELECT * from hypertable_compression_stats('#{self.hypertable_name}')").first || {} end |
#detailed_size ⇒ Object
40 41 42 |
# File 'lib/timescaledb/hypertable.rb', line 40 def detailed_size struct_from("SELECT * FROM hypertable_detailed_size('#{self.hypertable_name}')").first end |
#main_dimension ⇒ Object
23 24 25 |
# File 'lib/timescaledb/hypertable.rb', line 23 def main_dimension dimensions.find_by dimension_number: 1 end |