On Fri, 17 Sep 2010 22:33:07 -0700, Igal Koshevoy wrote: > Date: Fri, 17 Sep 2010 22:33:07 -0700 > From: Igal Koshevoy <[email protected]> > To: [email protected] > Subject: [Puppet-dev] [PATCH/puppet-dashboard 1/1] [#4357] Add reports > database index to improve performance. > X-Mailer: git-send-email 1.7.2.3 > Message-Id: <[email protected]> > > Added index to speed up the expensive query run in Status::by_interval. > > Signed-off-by: Igal Koshevoy <[email protected]> > --- > .../20100916183948_adjust_indexes_on_reports.rb | 13 +++++++++++++ > db/schema.rb | 4 ++-- > 2 files changed, 15 insertions(+), 2 deletions(-) > create mode 100644 db/migrate/20100916183948_adjust_indexes_on_reports.rb > > diff --git a/db/migrate/20100916183948_adjust_indexes_on_reports.rb > b/db/migrate/20100916183948_adjust_indexes_on_reports.rb > new file mode 100644 > index 0000000..8b185ca > --- /dev/null > +++ b/db/migrate/20100916183948_adjust_indexes_on_reports.rb > @@ -0,0 +1,13 @@ > +class AdjustIndexesOnReports < ActiveRecord::Migration > + def self.up > + remove_index :reports, :time > + > + add_index :reports, [:time, :node_id, :success] > + end > + > + def self.down > + remove_index :reports, [:time, :node_id, :success] > + > + add_index :reports, :time > + end > +end > diff --git a/db/schema.rb b/db/schema.rb > index 1717d0b..e0aa526 100644 > --- a/db/schema.rb > +++ b/db/schema.rb > @@ -9,7 +9,7 @@ > # > # It's strongly recommended to check this file into your version control > system. > > -ActiveRecord::Schema.define(:version => 20100909191050) do > +ActiveRecord::Schema.define(:version => 20100916183948) do > > create_table "assignments", :force => true do |t| > t.integer "node_id" > @@ -89,7 +89,7 @@ ActiveRecord::Schema.define(:version => 20100909191050) do > end > > add_index "reports", ["node_id", "success"], :name => > "index_reports_on_node_id_and_success" > - add_index "reports", ["time"], :name => "index_reports_on_time" > + add_index "reports", ["time", "node_id", "success"], :name => > "index_reports_on_time_and_node_id_and_success" > > create_table "services", :force => true do |t| > t.string "name" > -- > 1.7.2.3 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. >
Again: So it's recorded here, too: +1 -- Jacob Helwig
signature.asc
Description: Digital signature
