@@ -58,6 +58,10 @@ INSERT INTO child (c, p, crdb_region) VALUES (1000, 100, 'us-east-1'), (2000, 20
58
58
statement ok
59
59
ANALYZE great_grandparent;
60
60
61
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
62
+ statement ok
63
+ SELECT crdb_internal.clear_table_stats_cache();
64
+
61
65
# Only the scan in the main query is parallelized when we don't have stats on
62
66
# the descendant tables.
63
67
query I
@@ -68,6 +72,10 @@ SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i =
68
72
statement ok
69
73
ANALYZE grandparent;
70
74
75
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
76
+ statement ok
77
+ SELECT crdb_internal.clear_table_stats_cache();
78
+
71
79
# Now we also should parallelize lookup join into the grandparent table.
72
80
query I
73
81
SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i = 1] WHERE info LIKE '%parallel%';
@@ -77,6 +85,10 @@ SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i =
77
85
statement ok
78
86
ANALYZE parent;
79
87
88
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
89
+ statement ok
90
+ SELECT crdb_internal.clear_table_stats_cache();
91
+
80
92
# Now we also should parallelize lookup join into the parent table.
81
93
query I
82
94
SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i = 1] WHERE info LIKE '%parallel%';
@@ -86,6 +98,10 @@ SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i =
86
98
statement ok
87
99
ANALYZE child;
88
100
101
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
102
+ statement ok
103
+ SELECT crdb_internal.clear_table_stats_cache();
104
+
89
105
# Finally, all three lookup joins as well as the scan in the main query should
90
106
# be parallelized.
91
107
query T
@@ -288,6 +304,10 @@ ALTER TABLE grandparent INJECT STATISTICS '[
288
304
}
289
305
]'
290
306
307
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
308
+ statement ok
309
+ SELECT crdb_internal.clear_table_stats_cache();
310
+
291
311
query I
292
312
SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i = 1] WHERE info LIKE '%parallel%';
293
313
----
@@ -329,6 +349,10 @@ ALTER TABLE grandparent INJECT STATISTICS '[
329
349
}
330
350
]'
331
351
352
+ # Clear the stat cache so that the new statistic is guaranteed to be used.
353
+ statement ok
354
+ SELECT crdb_internal.clear_table_stats_cache();
355
+
332
356
query I
333
357
SELECT count(*) FROM [EXPLAIN (VERBOSE) DELETE FROM great_grandparent WHERE i = 1] WHERE info LIKE '%parallel%';
334
358
----
0 commit comments