Class: Timescaledb::Stats::Hypertables

Inherits:
Object
  • Object
show all
Defined in:
lib/timescaledb/stats/hypertables.rb

Instance Method Summary collapse

Constructor Details

#initialize(hypertables = [], connection = Timescaledb.connection) ⇒ Hypertables

Returns a new instance of Hypertables.

Parameters:

  • connection (Timescaledb:Connection) (defaults to: Timescaledb.connection)

    The PG connection.

  • hypertables (Array<String>) (defaults to: [])

    The list of hypertable names.



8
9
10
11
# File 'lib/timescaledb/stats/hypertables.rb', line 8

def initialize(hypertables = [], connection = Timescaledb.connection)
  @connection = connection
  @hypertables = hypertables.map(&method('hypertable_name_with_schema'))
end

Instance Method Details

#to_hHash

Returns The hypertables stats.

Returns:

  • (Hash)

    The hypertables stats



16
17
18
19
20
21
22
23
24
# File 'lib/timescaledb/stats/hypertables.rb', line 16

def to_h
  {
    count: @hypertables.count,
    uncompressed_count: uncompressed_count,
    approximate_row_count: approximate_row_count,
    chunks: Timescaledb::Stats::Chunks.new(@hypertables).to_h,
    size: size
  }
end