V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wuwukai007
V2EX  ›  Python

mysql 8.0.21-8.0.26 优化了子查询一些操作?,提升蛮大的

  •  
  •   wuwukai007 · Oct 28, 2022 · 3332 views
    This topic created in 1277 days ago, the information mentioned may be changed or developed.
    select
    CASE
         WHEN (`ticket`.num IS NOT NULL) THEN 'web'
         WHEN (`ticket`.num IS NULL) THEN (SELECT CASE
                                                       WHEN (`channel`.`NAME` = '渠道 1')
                                                       THEN 'app'
                                                       WHEN (`channel`.`NAME` = '渠道 2')
                                                       THEN '小程序'
                                                       ELSE '其他' END AS channel
           FROM `channel`,
                `sreq`
           WHERE `channel`.`chanid` = `S_SRV_REQ`.`chanid`
             AND `ticket`.req_id = `sreq`.`REQ_ID`
           LIMIT 1) END AS channel
    from ticket where ...;
    
    9 replies    2022-10-29 08:58:23 +08:00
    optional
        1
    optional  
       Oct 28, 2022 via iPhone
    WHEN (`channel`.`NAME` = '渠道 1')
    THEN '渠道 2'
    WHEN (`channel`.`NAME` = '渠道 3')
    THEN '渠道 4'


    xswl
    wuwukai007
        2
    wuwukai007  
    OP
       Oct 28, 2022
    @optional 这不重要哈,随便找的 sql ,主要是子查询优化蛮明显的
    sadfQED2
        3
    sadfQED2  
       Oct 28, 2022 via Android
    万年 5.7 路过,不知道等到 2032 年公司运维会不会升级到 8
    leegradyllljjjj
        4
    leegradyllljjjj  
       Oct 28, 2022 via Android
    mysql 确实是容易死锁
    bthulu
        5
    bthulu  
       Oct 28, 2022
    万年 5.0 路过, 每次想升级, 运维总是说又不是不能用.
    好像他说的也没错, 线上跑的还挺稳的
    YepTen
        6
    YepTen  
       Oct 28, 2022
    羡慕能升 8.0 的,万年 5.7 。
    simple2025
        7
    simple2025  
       Oct 28, 2022
    又不是不能用,dog
    fyw321451
        8
    fyw321451  
       Oct 28, 2022 via iPhone
    5.7 的还好了 我们是 5.4
    wxf666
        9
    wxf666  
       Oct 29, 2022
    希望能优化下 `WITH RECURSIVE` 递归 CTE 查询

    相同数据量和结果的情况下,几层递归就比非递归版本耗时翻一倍。。损耗有点大。。

    可见这个 [帖子回复]( https://v2ex.com/t/889443#r_12274236 )
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4660 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 10:07 · PVG 18:07 · LAX 03:07 · JFK 06:07
    ♥ Do have faith in what you're doing.