You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the number of columns when estimating the Sort's cost.
During the multicolumn sort, we apply a comparison operator to each column one
by one. So, even keeping aside the cost of a specific operator, we should take
into account the number of its calls.
This code impacts the cost model of GatherMerge, IncrementalSort, Sort, and
MergeAppend. It also alters the balance between ordered and hashed operations,
which should be benchmarked and tuned carefully.
Relations: (public.ftprt1_p1 t1) LEFT JOIN (public.ftprt2_p1 fprt2)
9992
-
Remote SQL: SELECT r5.a, r6.b, r6.c FROM (public.fprt1_p1 r5 LEFT JOIN public.fprt2_p1 r6 ON (((r5.a = r6.b)) AND ((r5.b = r6.a)) AND ((r6.a < 10)))) WHERE ((r5.a < 10)) ORDER BY r5.a ASC NULLS LAST, r6.b ASC NULLS LAST, r6.c ASC NULLS LAST
9993
-
(4 rows)
9991
+
Sort Key: t1.a, fprt2.b, fprt2.c
9992
+
-> Foreign Scan
9993
+
Output: t1.a, fprt2.b, fprt2.c
9994
+
Relations: (public.ftprt1_p1 t1) LEFT JOIN (public.ftprt2_p1 fprt2)
9995
+
Remote SQL: SELECT r5.a, r6.b, r6.c FROM (public.fprt1_p1 r5 LEFT JOIN public.fprt2_p1 r6 ON (((r5.a = r6.b)) AND ((r5.b = r6.a)) AND ((r6.a < 10)))) WHERE ((r5.a < 10))
9996
+
(7 rows)
9994
9997
9995
9998
SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) t2 ON (t1.a = t2.b and t1.b = t2.a) WHERE t1.a < 10 ORDER BY 1,2,3;
Copy file name to clipboardExpand all lines: src/test/regress/expected/partition_join.out
+5-3
Original file line number
Diff line number
Diff line change
@@ -1235,9 +1235,11 @@ EXPLAIN (COSTS OFF)
1235
1235
SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b;
@@ -1286,7 +1288,7 @@ SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2
1286
1288
-> Sort
1287
1289
Sort Key: t2_3.b
1288
1290
-> Seq Scan on prt2_p3 t2_3
1289
-
(51 rows)
1291
+
(53 rows)
1290
1292
1291
1293
SELECT t1.a, t1.c, t2.b, t2.c, t3.a + t3.b, t3.c FROM (prt1 t1 LEFT JOIN prt2 t2 ON t1.a = t2.b) RIGHT JOIN prt1_e t3 ON (t1.a = (t3.a + t3.b)/2) WHERE t3.c = 0 ORDER BY t1.a, t2.b, t3.a + t3.b;
0 commit comments