Slow query on “UNION ALL” view

后端 未结 8 1928
伪装坚强ぢ
伪装坚强ぢ 2021-02-13 06:20

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 /         


        
8条回答
  •  無奈伤痛
    2021-02-13 07:04

    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.

提交回复
热议问题