From 550ea3a75f61de65df7e1d367c7fbe1ac2c68531 Mon Sep 17 00:00:00 2001 From: Daniil Anisimov Date: Tue, 11 Apr 2023 01:16:24 +0700 Subject: [PATCH] Bugfix. Correctly use of a routine for joins counting. --- expected/aqo_fdw.out | 2 +- expected/feature_subspace.out | 4 ++-- expected/look_a_like.out | 20 ++++++++++---------- expected/unsupported.out | 2 +- postprocessing.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/expected/aqo_fdw.out b/expected/aqo_fdw.out index 69c1b132..ca69fab4 100644 --- a/expected/aqo_fdw.out +++ b/expected/aqo_fdw.out @@ -120,7 +120,7 @@ SELECT str FROM expln(' AQO not used Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (14 rows) -- Should learn on postgres_fdw nodes diff --git a/expected/feature_subspace.out b/expected/feature_subspace.out index a53b57e7..eceb0eb1 100644 --- a/expected/feature_subspace.out +++ b/expected/feature_subspace.out @@ -43,7 +43,7 @@ WHERE str NOT LIKE '%Memory%'; AQO not used Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (14 rows) -- TODO: Using method of other classes neighbours we get a bad estimation. @@ -66,7 +66,7 @@ WHERE str NOT LIKE '%Memory%'; AQO not used Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (14 rows) -- Look into the reason: two JOINs from different classes have the same FSS. diff --git a/expected/look_a_like.out b/expected/look_a_like.out index fb76fdd6..9e3dc286 100644 --- a/expected/look_a_like.out +++ b/expected/look_a_like.out @@ -56,7 +56,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 900 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (16 rows) SELECT str AS result @@ -83,7 +83,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 900 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (19 rows) SELECT str AS result @@ -108,7 +108,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 500 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) --query contains nodes that have already been predicted @@ -134,7 +134,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 500 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) SELECT str AS result @@ -159,7 +159,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 300 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) SELECT str AS result @@ -184,7 +184,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 600 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) SELECT str AS result @@ -209,7 +209,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 500 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) --query contains nodes that have already been predicted @@ -235,7 +235,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Rows Removed by Filter: 600 Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (17 rows) SELECT str AS result @@ -516,7 +516,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Output: b.y1, b.y2, b.y3 Using aqo: true AQO mode: LEARN - JOINS: 1 + JOINS: 2 (24 rows) SELECT str AS result @@ -548,7 +548,7 @@ WHERE str NOT LIKE 'Query Identifier%' and str NOT LIKE '%Memory%' and str NOT L Output: c.z1, c.z2, c.z3 Using aqo: true AQO mode: LEARN - JOINS: 1 + JOINS: 2 (24 rows) RESET aqo.wide_search; diff --git a/expected/unsupported.out b/expected/unsupported.out index a1a6f4ae..6e45dcd8 100644 --- a/expected/unsupported.out +++ b/expected/unsupported.out @@ -487,7 +487,7 @@ SELECT * FROM Filter: (x > 20) Using aqo: true AQO mode: LEARN - JOINS: 0 + JOINS: 1 (13 rows) -- AQO needs to predict total fetched tuples in a table. diff --git a/postprocessing.c b/postprocessing.c index ba2e19e0..6850cde4 100644 --- a/postprocessing.c +++ b/postprocessing.c @@ -916,7 +916,7 @@ StorePlanInternals(QueryDesc *queryDesc) MemoryContext oldctx = MemoryContextSwitchTo(AQOCacheMemCtx); njoins = 0; - planstate_tree_walker(queryDesc->planstate, calculateJoinNum, &njoins); + calculateJoinNum(queryDesc->planstate, &njoins); if (queryDesc->queryEnv == NULL) queryDesc->queryEnv = create_queryEnv();