1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fixed cost calculations for materialized tables

One effect of this change in the test suite is that tests with very few
rows changed to use sub queries instead of materialization. This is
correct and expected as for these the materialization overhead is too high.

A lot of tests where fixed to still use materialization by adding a
few rows to the tables (most tests has only 2-3 rows and are thus easily
affected when cost computations are changed).

Other things:
- Added more variables to TMPTABLE_COSTS for better cost calculation
- Added cost of copying rows to TMPTABLE_COSTS lookup and write
- Added THD::optimizer_cache_hit_ratio for easier cost calculations
- Added DISK_FAST_READ_SIZE to be used when calculating costs when
  reading big blocks from a disk
This commit is contained in:
Monty
2022-06-16 13:12:01 +03:00
committed by Sergei Petrunia
parent 1d82e5daf7
commit 4515a89814
50 changed files with 566 additions and 371 deletions

View File

@ -728,19 +728,6 @@ EXPLAIN
"filtered": 100
}
},
{
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 10,
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "119",
"join_type": "BNL"
}
},
{
"table": {
"table_name": "<subquery2>",
@ -769,6 +756,19 @@ EXPLAIN
}
}
}
},
{
"block-nl-join": {
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 10,
"filtered": 100
},
"buffer_type": "flat",
"buffer_size": "1Kb",
"join_type": "BNL"
}
}
]
}
@ -1078,7 +1078,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "!<in_optimizer>(t1.a,t1.a in (subquery#2))"
"attached_condition": "!<in_optimizer>(t1.a,<exists>(subquery#2))"
}
}
],
@ -1086,13 +1086,15 @@ EXPLAIN
{
"query_block": {
"select_id": 2,
"having_condition": "trigcond(t2.b is null)",
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
"filtered": 100,
"attached_condition": "trigcond(<cache>(t1.a) = t2.b or t2.b is null)"
}
}
]