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

Filters are very long to be displayed with MsSQL as soon as the result is sorted on a metric

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1
    • Component/s: Measures
    • Labels:
      None

      Description

      In such case, MsSQL doesn't use the measures_sid_metric index to optimize the join between the snapshots and project_measures tables.

      One possible option is to explicitly ask MsSQL to use this index :

      SELECT 
      s.id, 
      MAX(s.project_id) as pid, 
      MAX(s.root_project_id) as rpid, 
      MAX(CASE WHEN pm.metric_id=42 THEN value ELSE NULL END)AS sortvalue   
      FROM 
              sonar.snapshots s   
              INNER JOIN sonar.project_measures pm WITH (INDEX(measures_sid_metric)) 
              ON s.id=pm.snapshot_id  INNER JOIN sonar.projects p ON s.project_id=p.id 
      WHERE   
              pm.rule_id is null 
              AND pm.rule_priority is null 
              AND pm.characteristic_id IS NULL 
              AND  s.status= @P0  AND s.islast= @P1   
              AND s.qualifier IN ( @P2 )  AND UPPER(p.kee) LIKE  @P3  AND p.copy_resource_id IS NULL 
      GROUP BY s.id 
      

        Attachments

          Activity

            People

            Assignee:
            simon.brandhof Simon Brandhof (Inactive)
            Reporter:
            freddy.mallet Freddy Mallet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: