Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-7176

The SQL query used to get next task can be very slow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2
    • Fix Version/s: 5.3
    • Component/s: Compute Engine, Database
    • Labels:
      None

      Description

      The query used to get next task to processed can take a lot of time when the number of task is big (for instance, when there 1000 tasks, it can take 30 seconds).

      Example of log :

      2016.01.07 09:08:21 TRACE web[sql] time=18375ms | sql=select cq.uuid    from ce_queue cq    where cq.status='PENDING'    and not exists(    select 1    from ce_queue cq2    where cq.component_uuid=cq2.component_uuid and cq2.status <> 'PENDING'    )         order by cq.created_at asc, cq.id asc
      

      Technical details :
      The solution is to add an index on CE_QUEUE.COMPONENT_UUID :

      CREATE INDEX ce_queue_cpt_uuid  ON ce_queue (component_uuid)
      

        Attachments

          Activity

            People

            Assignee:
            julien.lancelot Julien Lancelot
            Reporter:
            julien.lancelot Julien Lancelot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: