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/13 02:58:47 UTC

[GitHub] [skywalking] tristaZero edited a comment on issue #4047: Modify query SQL for MySQLDAO

tristaZero edited a comment on issue #4047: Modify query SQL for MySQLDAO
URL: https://github.com/apache/skywalking/pull/4047#issuecomment-565279563
 
 
   Here are test results,
   ```
   ##### The original SQL:
   select * from (select avg(value) value,entity_id from endpoint_avg where time_bucket >= ? and time_bucket <= ? group by entity_id) AS METRICS order by value desc limit 10
   
   ##### The rewritten SQL:
   select avg(value) value,entity_id from endpoint_avg where time_bucket >= ? and time_bucket <= ? group by entity_id order by value desc limit 10
   
   ##### SQLss similar with the above ones,
   
   mysql> select * from (select avg(item_id) value,order_id from t_order_item_1 group by order_id) tb order by value desc limit 2;
   +--------+----------+
   | value  | order_id |
   +--------+----------+
   | 8.0000 |        2 |
   | 6.3333 |        1 |
   +--------+----------+
   2 rows in set (0.01 sec)
   
   mysql> select avg(item_id) value, order_id from t_order_item_1 group by order_id order by value desc limit 2;
   +--------+----------+
   | value  | order_id |
   +--------+----------+
   | 8.0000 |        2 |
   | 6.3333 |        1 |
   +--------+----------+
   2 rows in set (0.00 sec)

----------------------------------------------------------------
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