开发者社区> 问答> 正文

这个sql应该怎么样优化呢?求大神指点

我叫石头 2019-03-28 15:03:24 228

SELECT

    * 
FROM
    (SELECT
        "operator_order".*,
        ROW_NUMBER() OVER (PARTITION 
    BY
        operator_order.order_num ) AS num_index 
    FROM
        comp.operator_order AS operator_order 
    WHERE
        (
            grade_list 
            AND (
                '{5,7,8,9,10,11}'
            )
        ) 
        AND (
            paid_time BETWEEN '2018-03-19 04:00:44+00:00:00' AND '2019-03-20 04:00:44+00:00:00'
        ) 
    ORDER BY
        "order_time" DESC) AS operator 
WHERE
    num_index = 1 LIMIT 20
SQL
分享到
取消 提交回答
全部回答(0)
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

推荐文章
相似问题
推荐课程