sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

use sqlx query takes longer than execute sql command in mysql

Open kingeasternsun opened this issue 8 years ago • 3 comments

this is output of software using sqlx,takes 1.513185157s :

2017/12/09 09:40:59 |DEBUG||quickmysql.go|queryProduceReportListOfDidFromDb()|69| select mac ,result,processname,processnum,processid,report
time,userid from mytable where mac = 'c4430d70c66d' and orderid = 'orderid142'
2017/12/09 09:41:01 |DEBUG||quickmysql.go|queryProduceReportListOfDidFromDb()|78|1.513185157s

execute the same command in mysql, only takes 0.02754125s ( to avoid the cache, another test use different mac ,but both have same rows in the table)

mysql> show profiles;
|        4 | 0.02754125 | select sql_no_cache mac as did,result,processname,processnum,processid,reporttime,userid from mytable where mac = 'c4430d70c66c' and orderid = 'orderid142' |

the table totally has 1598321 rows,and the query result above has 183 results.

kingeasternsun avatar Dec 09 '17 02:12 kingeasternsun