scaoping 发表于 2018-10-14 14:00:18

sql优化-检索及定位

MariaDB > show profiles;  
+----------+------------+------------------------------------------------------------------------------------------------------------------+
  
| Query_ID | Duration   | Query                                                                                                            |
  
+----------+------------+------------------------------------------------------------------------------------------------------------------+
  
|      6 | 0.00038804 | select * from orders limit 1                                                                            |
  
|      7 | 0.00019379 | select * from orders limit 1                                                                            |
  
|      8 | 0.00028797 | select * from user limit 1                                                                              |
  
|      9 | 0.00006671 | select * from orders right user where orders.ID=user.id                        |
  
|       10 | 0.00336970 | select orders*.user.id fromwhere orders.ID=user.id                           |
  
|       11 | 0.00005291 | select orders*,user.id fromwhere orders.ID=user.id                           |
  
|       12 | 0.00004725 | select orders*,user.id fromorders,user where orders.ID=user.id |
  
|       13 | 0.00003863 | select orders*,user.id fromorders,user where orders.ID=user.id |
  
|       14 | 0.00024284 | select * from orders limit 1                                                                            |
  
|       15 | 0.00027788 | select * from orders limit 10                                                                           |
  
|       16 | 0.00007312 | select * from user where user='liaoxz';
  
select * from user where user='liaoxz'                  |
  
|       17 | 0.00031860 | select * from user limit 1                                                                              |
  
|       18 | 0.02771239 | select * from user where user_name='liaoxz'                                                               |
  
|       19 | 0.03121868 | select * from user where user_name='liaoxz'                                                               |
  
|       20 | 0.02219678 | select * from user where user_name='liaoxz'                                                               |
  
+----------+------------+------------------------------------------------------------------------------------------------------------------+
  
15 rows in set (0.00 sec)


页: [1]
查看完整版本: sql优化-检索及定位