Project

General

Profile

Bug #1837

add some indexes to improve performance

Added by Gustavo Soares almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
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

Associated revisions

Revision e1291b41 (diff)
Added by Gustavo Soares Souza almost 10 years ago

fixes #1837 add some indexes to improve performance

History

#1 Updated by Ohad Levy almost 10 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 :)

#2 Updated by Gustavo Soares almost 10 years ago

Sure. I'll do that.

#3 Updated by Anonymous almost 10 years ago

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

Also available in: Atom PDF