Class: Gitlab::Database::PostgresAutovacuumActivity

Inherits:
SharedModel
  • Object
show all
Defined in:
lib/gitlab/database/postgres_autovacuum_activity.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SharedModel

connection, #connection_db_config, connection_pool, using_connection

Class Method Details

.for_tables(tables) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/gitlab/database/postgres_autovacuum_activity.rb', line 11

def self.for_tables(tables)
  Gitlab::Database::LoadBalancing::Session.current.use_primary do
    # calling `.to_a` here to execute the query in the primary's scope
    # and to avoid having the scope chained and re-executed
    #
    where('schema = current_schema()').where(table: tables).to_a
  end
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/gitlab/database/postgres_autovacuum_activity.rb', line 20

def to_s
  "table #{table_identifier} (started: #{vacuum_start})"
end