We’re updating our terminology in Jira

The term ‘project’ will soon be replaced with 'space'. You may notice some inconsistencies while we make this change.

JQL 最適化の推奨事項

All JQL queries are not created equal. JQL uses a strict logic that will do exactly what you tell it to do, whether or not it’s the most efficient way. These inefficiencies can add up, causing performance issues in boards, plans, or spaces.

このページでは、効率的な JQL クエリを記述するための一般的なガイドラインについて説明します。

クエリの範囲を制限する

When constructing your JQL query, tell Jira where it should search for work items by including or excluding specific spaces or boards.

When a query has to search through fewer work items, results load faster.

Let’s say you want to view all the work assigned to you using a JQL filter. However, you only work on two spaces within your entire organization.

このクエリは次のように機能します。

assignee is currentUser()

しかし、次のほうが良いでしょう。

project in (The Big Cheese, Project Kanban) and assignee is currentUser()

これには、次のような理由があります。

The first query searches through all of the work items in your site to find the ones assigned to you. The second query is more focused on your spaces. If your site has 10,000 work items Jira can look at the 500 work items in those spaces and can ignore the remaining 9,500. Fewer work items to sort through, the quicker the query can run, even though the results are the same.

You can also use other fields to narrow the scope of your JQL query, such as dates, or last viewed.

メイン句には OR を、サブ句には AND を使用する

Jira がクエリを解釈する方法によって一見論理的な文字列が複数の冗長な検索に分割されて、実行に時間がかかる場合があります。重複検索の一般的な原因は、メイン句で AND を使用することです。AND は主にサブ句で使用して、OR をメイン句用に取っておくことをお勧めします。つまり、簡単に言うと、OR 句は括弧の外側に、AND 句は内側に入れることをお勧めします。

Say you use a JQL query to only show work items included in Project PMO or assigned to Assignee A as well as those from Project TIS or assigned to Assignee B.

このクエリは次のように機能します。

(project = TIS OR assignee = A) AND (project = PMO OR assignee = B)

しかし、次のほうが良いでしょう。

project in (TIS, PMO) OR assignee in (A, B)

これには、次のような理由があります。

This is because when JQL contains an AND clause, Jira only returns work items that match both sub-clauses not either/or, and would interpret the first query as:

  • in Project TIS AND in Project PMO

  • assigned to Assignee B AND in Project TIS

  • assigned to Assignee A AND in Project PMO

  • assigned to Assignee A AND assigned to Assignee B

Jira Software Cloud における JQL によるクエリの解釈方法に関する詳細



あとの 2 つの検索では結果は返されず、Jira では検索が引き続き実行されます。このような不要な検索によって、JQL クエリのパフォーマンスが低下する可能性があります。2 番目のクエリでは冗長な検索が除外されるため、大規模なデータ セットの実行時間に大きく影響する可能性があります。

Again, include a specific space or board to make sure the query doesn’t have to sift through unnecessary work items.

問題を起こすフィールドや関数を避ける

一部のフィールドは、その複雑さのために低速になることがわかっています。たとえば、label フィールドは複数のデータ セットを参照する必要があるため、検索で使用するには複雑なフィールドです。ただし、IssueKey フィールドによって同じ結果を迅速に取得できます。

また、特定の関数が問題になる可能性があります。たとえば、portfolioChildIssuesOf 関数の使用には、データベースを介したいくつかの再帰が必要です。現状として、これには推奨できる回避策はありません。

JQL クエリは句ごとに構築する

ここで説明する 2 つのフィールドと関数は、すべてを網羅するリストではありません。クエリの遅延の原因となっているフィールドや関数を特定するには、すべてのフィールドと関数を一度に記述するのではなく句ごとに構築します。句に関数を徐々に追加してから検索を実行することで最も遅いフィールドを特定できるため、そのようなフィールドを軽減または回避できます。

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。