lib/postgres_to_redshift/tuning.rb
def distribution_key
      return foreign_key_column_name_to_optimised_table if can_optimise_for_different_table?

      primary_key_column_name
    end
# If there is a reference to the optimised table, distribute by this column in order to optimise any join with optimised table
# Else, distribute by PK to optimise any joins or filter on this table
If there is a reference to the optimised table, distribute by this column in order to optimise any join with optimised table
Else, distribute by PK to optimise any joins or filter on this table
If there is a reference to the optimised table distribute by this column in order to optimise any join with optimised table Else distribute by PK to optimise any joins or filter on this table
def distribution_key
      return foreign_key_column_name_to_optimised_table if can_optimise_for_different_table?
      primary_key_column_name
    end
def distribution_key return foreign_key_column_name_to_optimised_table if can_optimise_for_different_table? primary_key_column_name end
If there is a reference to the optimised table, distribute by this column in order to optimise any join with optimised table
Else, distribute by PK to optimise any joins or filter on this table
If there is a reference to the optimised table distribute by this column in order to optimise any join with optimised table Else distribute by PK to optimise any joins or filter on this table