Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-17080

Useless expensive select against the jiraissue table

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 4.4, Bugfix Release
    • None
    • None

    Description

      JAC keeps issuing this query

      SELECT ID, pkey, PROJECT, REPORTER, ASSIGNEE, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, VOTES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT FROM public.jiraissue WHERE pkey IS NULL
      

      Which is expensive

      atljira=# explain SELECT ID, pkey, PROJECT, REPORTER, ASSIGNEE, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, VOTES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT FROM public.jiraissue WHERE pkey IS NULL;
                                QUERY PLAN                           
      ---------------------------------------------------------------
       Seq Scan on jiraissue  (cost=0.00..12545.51 rows=1 width=669)
         Filter: (pkey IS NULL)
      (2 rows)
      

      And always returns no results

      jac_production_user=# select count(*) from jiraissue where pkey is null; count -------
           0
      (1 row)
      

      and shouldn't ever return any results because an issue cannot exist without an issue key (? is this true), so the schema should probably reflect that

      jac_production_user=# \d jiraissue
                        Table "public.jiraissue"
              Column        |           Type           | Modifiers 
      ----------------------+--------------------------+-----------
       id                   | numeric(18,0)            | not null
       pkey                 | character varying(255)   | 
      

      as well as an UNIQUE index created on that column to enforce that constraint

      Attachments

        Activity

          People

            bbaker ɹǝʞɐq pɐɹq
            dcheney David Cheney (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: