Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a3a836f

Browse files
committed
Attempt to fix newly added Memoize regression test
Both drongo and fairywren seem not to like a new regression test added by 2cca95e. These machines show a different number of actual rows in the EXPLAIN ANALYZE output. Since the number of actual rows is divided by the number of loops, I suspect this might be due to some platform dependant rounding behavior as the total row count is 5 and the number of loops is 2. drongo and fairywren seem to be calculating that 5.0 / 2.0 is 3, whereas most other machines think the answer is 2. Here we tweak the test query's WHERE clause so it's 4.0 / 2.0 instead. There shouldn't be too much wiggle room for platform dependant-behavior to be a factor with those numbers. Reported-by: Tom Lane Discussion: https://postgr.es/m/1035225.1706301718%40sss.pgh.pa.us
1 parent 5e444a2 commit a3a836f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/test/regress/expected/memoize.out

+6-6
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ WHERE t1.unique1 < 1000;
9696
SELECT explain_memoize('
9797
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
9898
LATERAL (
99-
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
99+
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
100100
) t2
101101
ON t1.two = t2.two
102102
WHERE t1.unique1 < 10;', false);
103103
explain_memoize
104104
----------------------------------------------------------------------------------------------
105105
Aggregate (actual rows=1 loops=N)
106-
-> Nested Loop Left Join (actual rows=25 loops=N)
106+
-> Nested Loop Left Join (actual rows=20 loops=N)
107107
-> Index Scan using tenk1_unique1 on tenk1 t1 (actual rows=10 loops=N)
108108
Index Cond: (unique1 < 10)
109109
-> Memoize (actual rows=2 loops=N)
@@ -113,20 +113,20 @@ WHERE t1.unique1 < 10;', false);
113113
-> Subquery Scan on t2 (actual rows=2 loops=N)
114114
Filter: (t1.two = t2.two)
115115
Rows Removed by Filter: 2
116-
-> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=5 loops=N)
117-
Index Cond: (unique1 < 5)
116+
-> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=4 loops=N)
117+
Index Cond: (unique1 < 4)
118118
(13 rows)
119119

120120
-- And check we get the expected results.
121121
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
122122
LATERAL (
123-
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
123+
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
124124
) t2
125125
ON t1.two = t2.two
126126
WHERE t1.unique1 < 10;
127127
count | avg
128128
-------+------------------------
129-
25 | 0.40000000000000000000
129+
20 | 0.50000000000000000000
130130
(1 row)
131131

132132
-- Reduce work_mem and hash_mem_multiplier so that we see some cache evictions

src/test/regress/sql/memoize.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ WHERE t1.unique1 < 1000;
6161
SELECT explain_memoize('
6262
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
6363
LATERAL (
64-
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
64+
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
6565
) t2
6666
ON t1.two = t2.two
6767
WHERE t1.unique1 < 10;', false);
6868

6969
-- And check we get the expected results.
7070
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
7171
LATERAL (
72-
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
72+
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
7373
) t2
7474
ON t1.two = t2.two
7575
WHERE t1.unique1 < 10;

0 commit comments

Comments
 (0)