You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/12/12 13:51:08 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #4047: Modify query SQL for MySQLDAO

wu-sheng commented on a change in pull request #4047: Modify query SQL for MySQLDAO
URL: https://github.com/apache/skywalking/pull/4047#discussion_r357154608
 
 

 ##########
 File path: oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLAggregationQueryDAO.java
 ##########
 @@ -44,14 +49,14 @@ public MySQLAggregationQueryDAO(
         String tableName = ModelName.build(downsampling, indName);
         StringBuilder sql = new StringBuilder();
         List<Object> conditions = new ArrayList<>(10);
-        sql.append("select * from (select avg(").append(valueCName).append(") value,").append(Metrics.ENTITY_ID).append(" from ")
+        sql.append("select avg(").append(valueCName).append(") value,").append(Metrics.ENTITY_ID).append(" from ")
             .append(tableName).append(" where ");
         this.setTimeRangeCondition(sql, conditions, startTB, endTB);
         if (appender != null) {
             appender.append(sql, conditions);
         }
         sql.append(" group by ").append(Metrics.ENTITY_ID);
-        sql.append(") AS METRICS order by value ").append(order.equals(Order.ASC) ? "asc" : "desc").append(" limit ").append(topN);
+        sql.append(" order by value ").append(order.equals(Order.ASC) ? "asc" : "desc").append(" limit ").append(topN);
 
 Review comment:
   Have you used real data set to verify this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services