speed up maintainer queries

This commit is contained in:
Alexander Machehin 2015-06-01 09:51:36 +05:00
parent ddf9987d21
commit fe51243cad
2 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,10 @@
class AddOrderIndexToBuildListPackages < ActiveRecord::Migration
def up
add_index :build_list_packages, name: :build_list_packages_ordering,
expression: "lower(build_list_packages.name) ASC, length(build_list_packages.name) ASC"
end
def down
remove_index :build_list_packages, name: :build_list_packages_ordering, if_exists: true
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150529034800) do
ActiveRecord::Schema.define(version: 20150601043133) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -102,6 +102,7 @@ ActiveRecord::Schema.define(version: 20150529034800) do
t.string "sha1"
t.integer "epoch"
t.text "dependent_packages"
t.index :name => "build_list_packages_ordering", :expression => "lower((name)::text), length((name)::text)"
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"