Re:Speeding up SQL queries by orders of magnitude using UNION
by iaabtpbtpnn on Saturday March 20, 2021 @10:51PM
(#26527756)
Those are both inner joins, just a different syntax for writing them.
Re:Speeding up SQL queries by orders of magnitude using UNION
by ohlookabird on Sunday March 21, 2021 @03:36AM
(#26528766)
They might be logically equivalent, but they are not identical if more than two tables are joined. For instance, the current Postgres docs say [1]:
> This latter equivalence does not hold exactly when more than two tables appear, because JOIN binds more tightly than comma. For example FROM T1 CROSS JOIN T2 INNER JOIN T3 ON condition is not the same as FROM T1, T2 INNER JOIN T3 ON condition because the condition can reference T1 in the first case but not the second.
[1] https://www.postgresql.org/docs/current/queries-table-expres...
this is true regardless of schema and statistics, it is simply how query planner works under the hood
and you can check it yourself on any database