Slow query on “UNION ALL” view

后端 未结 7 1245
说谎
说谎 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:22

    Combine the two tables. Add a column to indicate original table. If necessary, replace the original table names with views that select just the relevant part. Problem solved!

    Looking into the superclass/subclass db design pattern could be of use to you.

提交回复
热议问题