Project

General

Profile

Actions

Bug #1837

closed

add some indexes to improve performance

Added by Gustavo Soares over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Today The foreman in my company manages 3500 puppetclasses along with 5 environments.

Doing, a simple search in the puppetclasses controller without indexes by name takes too long! more than 30 seg, as follows:

Completed in 33232ms (View: 68, DB: 33151) | 200 OK [http://puppet.globoi.com/puppetclasses?search=cocoon]

with indexes:

Completed in 92ms (View: 69, DB: 12) | 200 OK [http://puppet.globoi.com/puppetclasses?search=cocoon

Here is the migration created to add some indexes to some columns..

class AddSomeIndexes < ActiveRecord::Migration
def self.up
#environments_puppetclasses
add_index :environments_puppetclasses, :puppetclass_id
add_index :environments_puppetclasses, :environment_id
#puppetclasses
add_index :puppetclasses, :name
#hostgroups_puppetclasses
add_index :hostgroups_puppetclasses, :puppetclass_id
add_index :hostgroups_puppetclasses, :hostgroup_id
end

def self.down
#environments_puppetclasses
remove_index :environments_puppetclasses, :puppetclass_id
remove_index :environments_puppetclasses, :environment_id
#puppetclasses
remove_index :puppetclasses, :name
#hostgroups_puppetclasses
remove_index :hostgroups_puppetclasses, :puppetclass_id
remove_index :hostgroups_puppetclasses, :hostgroup_id
end
end
Actions #1

Updated by Ohad Levy over 12 years ago

  • Target version set to 1.1

Great, any chance you would like to send it as a git patch Contribute ? this way you would get the credit :)

Actions #2

Updated by Gustavo Soares over 12 years ago

Sure. I'll do that.

Actions #3

Updated by Anonymous over 12 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF