开发者社区> 问答> 正文

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

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

展开
收起
我叫石头 2019-03-28 15:03:24 1462 0
0 条回答
写回答
取消 提交回答
问答分类:
SQL
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
SQL Server在电子商务中的应用与实践 立即下载
GeoMesa on Spark SQL 立即下载
原生SQL on Hadoop引擎- Apache HAWQ 2.x最新技术解密malili 立即下载