mysql 客户端的 --quick 选项

这个选项,对 SQL 执行的影响有多大呢?在查询一个 6kw 行的表时,影响巨大,带上 quick 后,性能提升 5 倍:

[root@localhost] time obclient --prompt "OceanBase(\u@\d)>"  --quick -h 127.0.0.1 -P 2828 -utest -DTEST  -e "select * from lineitem" > /dev/null
real    3m50.024s
user    2m35.192s
sys     0m21.271s


[root@localhost] time obclient --prompt "OceanBase(\u@\d)>"   -h 127.0.0.1 -P 2828 -utest -DTEST  -e  "select * from lineitem" > /dev/null
real    20m19.270s
user    20m2.626s
sys     0m17.645s

quick 背后是什么呢?

通过 mysql.cc 的源码可以一窥本质:

·{“quick”, ‘q’,
"Don’t cache result, print it row by row. This may slow down the server "
“if the output is suspended. Doesn’t use history file.”,

quick
这个 store_result 呢,它会一次性把服务器的数据缓存到本地,然后再输出到外部,是个阻塞接口,非常影响性能。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值