New account since lemmyrs.org went down, other @Deebsters are available.

  • 56 Posts
  • 1.02K Comments
Joined 3 年前
cake
Cake day: 2023年10月16日

help-circle


















  • It’s equivalent because UNION removes duplicates; the behaviour you’re describing happens with UNION ALL. Since both queries are article.*, both halves will have the same columns and the dedupe will be successful.

    UNION is less efficient because of this deduplication, but it’s the default since that’s what most people want. If that matters then you’d be correct that a JOIN version will be more efficient (possibly depending on indexes present and sql engine).