Class: RailsRedshiftReplicator::Tools::Analyze

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_redshift_replicator/tools/analyze.rb

Instance Method Summary collapse

Constructor Details

#initialize(table = nil) ⇒ Analyze

Updates the query plan to improve performance. see [docs.aws.amazon.com/redshift/latest/dg/r_ANALYZE.html]

Parameters:

  • table (String, :all) (defaults to: nil)

    table to analyze or :all



7
8
9
# File 'lib/rails_redshift_replicator/tools/analyze.rb', line 7

def initialize(table = nil)
  @table = (table.blank? || table.to_s == "all") ? nil : table
end

Instance Method Details

#performObject



11
12
13
14
15
# File 'lib/rails_redshift_replicator/tools/analyze.rb', line 11

def perform
  command = "ANALYZE #{@table};".squish
  RailsRedshiftReplicator.logger.debug(command)
  RailsRedshiftReplicator.connection.exec command
end