我有以下查询
SELECT `id`,'event' as type FROM `oc_event` where `Owner_id` = 1
UNION ALL
SELECT `id` ,'business' as type FROM `oc_business` where `Owner_id` = 1
UNION ALL
SELECT `id`, 'parts' as type FROM `oc_listing` where `Owner_id` = 1
虽然,结果是准确的,但是当提取的行数约为 1K 或更多时,它的速度很慢。有没有任何 mysql 关键字来优化这个简单的查询,或者你认为“UNION ALL”是正确的方法吗?
PS:我正在使用 PDO