]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4301 Remove order by id desc because it generates an important overhead
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 13 Jun 2013 14:31:36 +0000 (16:31 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 13 Jun 2013 14:32:41 +0000 (16:32 +0200)
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java

index 1495d7bf359a4432d9fa59c02f01e07bf1670908..aff84d575724c17a514b9143df1951806d11df83 100644 (file)
         </foreach>
       </foreach>
     </where>
-    order by i.id desc
   </select>
 
   <select id="selectIssues" parameterType="map" resultType="Issue" fetchSize="100000">
         and i.issue_creation_date &lt; #{query.createdBefore}
       </if>
     </where>
-    order by i.id desc
   </sql>
 
 </mapper>
index 504e475cdc32f0a58520447866674c7387759129..a792176d525319940199af55937e83ef031a49a4 100644 (file)
@@ -90,18 +90,6 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(issue.getId()).isNotNull();
   }
 
-  @Test
-  public void should_select_issues_sort_results_by_id_desc() {
-    setupData("shared", "should_select_all");
-
-    IssueQuery query = IssueQuery.builder().requiredRole("user").build();
-
-    List<IssueDto> results = dao.selectIssues(query);
-    assertThat(results.get(0).getId()).isEqualTo(102);
-    assertThat(results.get(1).getId()).isEqualTo(101);
-    assertThat(results.get(2).getId()).isEqualTo(100);
-  }
-
   @Test
   public void should_select_by_rules() {
     setupData("shared", "should_select_by_rules");
@@ -317,18 +305,6 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(results).hasSize(3);
   }
 
-  @Test
-  public void should_select_by_ids_sort_results_by_id_desc() {
-    setupData("shared", "should_select_by_ids");
-
-    List<IssueDto> results = newArrayList(dao.selectByIds(newArrayList(100l, 101l, 102l)));
-
-    assertThat(results.get(0).getId()).isEqualTo(102);
-    assertThat(results.get(1).getId()).isEqualTo(101);
-    assertThat(results.get(2).getId()).isEqualTo(100);
-  }
-
-
   private List<Long> getIssueIds(List<IssueDto> issues) {
     return newArrayList(Iterables.transform(issues, new Function<IssueDto, Long>() {
       @Override