Advertisement
AliaksandrLet

Many joins optimize

Jun 15th, 2023
1,337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EXPLAIN (ANALYZE)
  2. SELECT
  3.     *
  4. FROM
  5.     (
  6.     SELECT
  7.         t1.*
  8.     FROM
  9.         task31 t1
  10.         LEFT JOIN task35 t5 ON t5.link5 = t1.link1
  11.         LEFT JOIN task36 t6 ON t6.link6 = t1.link1
  12.         LEFT JOIN task310 t10 ON t10.link10 = t1.link1
  13.     ) AS t1
  14.     LEFT JOIN (
  15.         SELECT
  16.             t2.*
  17.         FROM
  18.             task32 t2
  19.             LEFT JOIN task33 t3 ON t3.link3 = t2.link2
  20.             LEFT JOIN task34 t4 ON t4.link4 = t2.link2
  21.             LEFT JOIN task37 t7 ON t7.link7 = t2.link2
  22.             LEFT JOIN task38 t8 ON t8.link8 = t2.link2
  23.             LEFT JOIN task39 t9 ON t9.link9 = t2.link2
  24.     ) AS t2 ON t2.link2 = t1.link1;
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement