Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLUNION vs UNION ALLSingle-choice MCQ

Performance-wise, why is UNION typically more expensive than UNION ALL even when you know the two inputs share no rows?

SELECT id FROM a UNION -- vs UNION ALL SELECT id FROM b;