Commit 884eec87dcc3e04af0026afd1668815e03244f3f
1 parent
51533efa
Exists in
master
and in
29 other branches
New migration to index product stuff
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
db/migrate/20120401211857_add_indexes_for_product_and_related.rb
0 → 100644
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +class AddIndexesForProductAndRelated < ActiveRecord::Migration | |
| 2 | + def self.up | |
| 3 | + # reduced from 75% to 5% postgres' cpu usage during solr indexing :) | |
| 4 | + add_index :products, :product_category_id | |
| 5 | + add_index :inputs, :product_category_id | |
| 6 | + add_index :inputs, :product_id | |
| 7 | + add_index :product_qualifiers, :product_id | |
| 8 | + add_index :product_qualifiers, :qualifier_id | |
| 9 | + add_index :product_qualifiers, :certifier_id | |
| 10 | + add_index :profiles, :region_id | |
| 11 | + end | |
| 12 | + | |
| 13 | + def self.down | |
| 14 | + remove_index :products, :product_category_id | |
| 15 | + remove_index :inputs, :product_category_id | |
| 16 | + remove_index :inputs, :product_id | |
| 17 | + remove_index :product_qualifiers, :product_id | |
| 18 | + remove_index :product_qualifiers, :qualifier_id | |
| 19 | + remove_index :product_qualifiers, :certifier_id | |
| 20 | + remove_index :profiles, :region_id | |
| 21 | + end | |
| 22 | +end | ... | ... |