从mysql工作台缩小查询

093gszye  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(439)

在mysql工作台上,我可以使用快捷方式美化sql查询 Ctrl + B . 有没有办法缩小mysql工作台的查询?
我的目标是减少使用量,优化响应速度。经过几次运行下面的查询后,它对于小型化的查询有更好的性能,对于大数据表会有很大的不同。
缩小(持续时间:第一次尝试:0.076秒,第二次尝试:0.082秒,第三次尝试:0.071秒)

SELECT (SELECT SUM(value) FROM keluar_masuk WHERE income_cost = 'income' AND currency = 'MYR')  + ((SELECT SUM(value) FROM keluar_masuk WHERE income_cost = 'income' AND currency = 'USD') * (SELECT value FROM site_data WHERE what = 'usd_to_myr')) as income, (SELECT SUM(value) FROM keluar_masuk WHERE income_cost = 'cost' AND currency = 'MYR')  + ((SELECT SUM(value) FROM keluar_masuk WHERE income_cost = 'cost' AND currency = 'USD') * (SELECT value FROM site_data WHERE what = 'usd_to_myr')) as cost

美化(持续时间:第一次尝试:0.146秒,第二次尝试:0.113秒,第三次尝试:0.125秒)

SELECT 
    (SELECT 
            SUM(value)
        FROM
            keluar_masuk
        WHERE
            income_cost = 'income'
                AND currency = 'MYR') + ((SELECT 
            SUM(value)
        FROM
            keluar_masuk
        WHERE
            income_cost = 'income'
                AND currency = 'USD') * (SELECT 
            value
        FROM
            site_data
        WHERE
            what = 'usd_to_myr')) AS income,
    (SELECT 
            SUM(value)
        FROM
            keluar_masuk
        WHERE
            income_cost = 'cost'
                AND currency = 'MYR') + ((SELECT 
            SUM(value)
        FROM
            keluar_masuk
        WHERE
            income_cost = 'cost'
                AND currency = 'USD') * (SELECT 
            value
        FROM
            site_data
        WHERE
            what = 'usd_to_myr')) AS cost
1tu0hz3e

1tu0hz3e1#

答案很简单:不,mysql工作台没有这样的特性。这真的不是人们经常想要的东西。

相关问题