mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-04 10:46:51 +02:00
Attempt to fix newly added Memoize regression test
Both drongo and fairywren seem not to like a new regression test added
by 2cca95e17
. 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
This commit is contained in:
parent
5e444a2526
commit
a3a836fb5e
@ -96,14 +96,14 @@ WHERE t1.unique1 < 1000;
|
|||||||
SELECT explain_memoize('
|
SELECT explain_memoize('
|
||||||
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
||||||
LATERAL (
|
LATERAL (
|
||||||
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
|
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
|
||||||
) t2
|
) t2
|
||||||
ON t1.two = t2.two
|
ON t1.two = t2.two
|
||||||
WHERE t1.unique1 < 10;', false);
|
WHERE t1.unique1 < 10;', false);
|
||||||
explain_memoize
|
explain_memoize
|
||||||
----------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------
|
||||||
Aggregate (actual rows=1 loops=N)
|
Aggregate (actual rows=1 loops=N)
|
||||||
-> Nested Loop Left Join (actual rows=25 loops=N)
|
-> Nested Loop Left Join (actual rows=20 loops=N)
|
||||||
-> Index Scan using tenk1_unique1 on tenk1 t1 (actual rows=10 loops=N)
|
-> Index Scan using tenk1_unique1 on tenk1 t1 (actual rows=10 loops=N)
|
||||||
Index Cond: (unique1 < 10)
|
Index Cond: (unique1 < 10)
|
||||||
-> Memoize (actual rows=2 loops=N)
|
-> Memoize (actual rows=2 loops=N)
|
||||||
@ -113,20 +113,20 @@ WHERE t1.unique1 < 10;', false);
|
|||||||
-> Subquery Scan on t2 (actual rows=2 loops=N)
|
-> Subquery Scan on t2 (actual rows=2 loops=N)
|
||||||
Filter: (t1.two = t2.two)
|
Filter: (t1.two = t2.two)
|
||||||
Rows Removed by Filter: 2
|
Rows Removed by Filter: 2
|
||||||
-> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=5 loops=N)
|
-> Index Scan using tenk1_unique1 on tenk1 t2_1 (actual rows=4 loops=N)
|
||||||
Index Cond: (unique1 < 5)
|
Index Cond: (unique1 < 4)
|
||||||
(13 rows)
|
(13 rows)
|
||||||
|
|
||||||
-- And check we get the expected results.
|
-- And check we get the expected results.
|
||||||
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
||||||
LATERAL (
|
LATERAL (
|
||||||
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
|
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
|
||||||
) t2
|
) t2
|
||||||
ON t1.two = t2.two
|
ON t1.two = t2.two
|
||||||
WHERE t1.unique1 < 10;
|
WHERE t1.unique1 < 10;
|
||||||
count | avg
|
count | avg
|
||||||
-------+------------------------
|
-------+------------------------
|
||||||
25 | 0.40000000000000000000
|
20 | 0.50000000000000000000
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- Reduce work_mem and hash_mem_multiplier so that we see some cache evictions
|
-- Reduce work_mem and hash_mem_multiplier so that we see some cache evictions
|
||||||
|
@ -61,7 +61,7 @@ WHERE t1.unique1 < 1000;
|
|||||||
SELECT explain_memoize('
|
SELECT explain_memoize('
|
||||||
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
||||||
LATERAL (
|
LATERAL (
|
||||||
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
|
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
|
||||||
) t2
|
) t2
|
||||||
ON t1.two = t2.two
|
ON t1.two = t2.two
|
||||||
WHERE t1.unique1 < 10;', false);
|
WHERE t1.unique1 < 10;', false);
|
||||||
@ -69,7 +69,7 @@ WHERE t1.unique1 < 10;', false);
|
|||||||
-- And check we get the expected results.
|
-- And check we get the expected results.
|
||||||
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
SELECT COUNT(*),AVG(t2.t1two) FROM tenk1 t1 LEFT JOIN
|
||||||
LATERAL (
|
LATERAL (
|
||||||
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 5 OFFSET 0
|
SELECT t1.two as t1two, * FROM tenk1 t2 WHERE t2.unique1 < 4 OFFSET 0
|
||||||
) t2
|
) t2
|
||||||
ON t1.two = t2.two
|
ON t1.two = t2.two
|
||||||
WHERE t1.unique1 < 10;
|
WHERE t1.unique1 < 10;
|
||||||
|
Loading…
Reference in New Issue
Block a user