Slow query on “UNION ALL” view

后端 未结 7 1260
说谎
说谎 2021-02-13 06:42

I have a DB view which basically consists of two SELECT queries with UNION ALL, like this:

CREATE VIEW v AS
SELECT time, etc. FROM t1 /         


        
7条回答
  •  借酒劲吻你
    2021-02-13 07:14

    I do not know Postgres, but some RMDBs handle comparison operators worse than BETWEEN in case of indexes. I would make an attempt using BETWEEN.

    SELECT ... FROM v WHERE time BETWEEN ... AND ...
    

提交回复
热议问题