プロジェクト

全般

プロフィール

Vote #77989

完了

The changeset display is slow when changeset_issues has very many records

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Performance_53
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
53
version_id:
119
issue_org_id:
24433
author_id:
95681
assigned_to_id:
1
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
110
ステータス-->[Closed]

説明

In issue page, the changeset display is slow when changeset_issues has very many records.

The following query is executed.


SELECT
  `changesets`.*
FROM
  `changesets`
  INNER JOIN `repositories`
    ON `repositories`.`id` = `changesets`.`repository_id`
  INNER JOIN `projects`
    ON `projects`.`id` = `repositories`.`project_id`
  INNER JOIN `changesets_issues`
    ON `changesets`.`id` = `changesets_issues`.`changeset_id`
WHERE
  `changesets_issues`.`issue_id` = 1
  ...

There is no INDEX in issue_id of changesets_issues table.

  • db/schema.rb
    
    create_table "changesets_issues", id: false, force: :cascade do |t|
    t.integer "changeset_id", null: false
    t.integer "issue_id",     null: false
    end

add_index "changesets_issues", ["changeset_id", "issue_id"], name: "changesets_issues_ids", unique: true, using: :btree

As a result, this query may be slow if there are a very many records in the changesets_issues table.

When the number of records in the changesets_issues table was about 1 million, it took 2 or 3 seconds to execute this query.
Adding INDEX to issue_id improved the performance of this query to a few milliseconds.


journals

--------------------------------------------------------------------------------
Index added in r16007.

Maybe we should also add an index on changeset_id to speed up the display of related issues on the changeset view. Do you have performance issues on the changeset view too?
--------------------------------------------------------------------------------
Thank you for fixing.

> Maybe we should also add an index on changeset_id to speed up the display of related issues on the changeset view. Do you have performance issues on the changeset view too?

There is no performance problem in changeset view.
Multiple column INDEX of changesets_id and issue_id seems to be used.

--------------------------------------------------------------------------------
OK, thanks for your feedback.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリPerformance_53 にセット
  • 対象バージョン3.4.0_119 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0