Why preserve repeated rows when appending event logs?
UNION ALL appends both query results while retaining duplicates. UNION removes duplicate result rows.
SQLite example and interpretation
Two independent requests can each take 12 ms. Both belong in traffic totals. Use an event identifier to decide whether a replay represents the same request.
SELECT 12 AS latency UNION ALL SELECT 12;Result [[12], [12]]
中文
为什么合并两批事件日志时要保留重复行?
UNION ALL 将两个查询的行合在一起,保留重复;UNION 会对完整结果行去重。
SQLite 示例与适用条件
两次独立请求耗时都为 12 毫秒,两行都应进入吞吐统计。是否同一事件应依靠事件编号判断。
SELECT 12 AS latency UNION ALL SELECT 12;结果 [[12], [12]]