If I try to remove the COMPRESSED attribute, I get this:
DOUBLE_PREC_HB
"filtered": 92.96875,
"r_filtered": 0,
JSON_HB
"filtered": 93,
"r_filtered": 0,
DOUBLE_PREC_HB becomes just as bad as JSON_HB. It looks like the good estimate in the original report has been an accident.
Sergei Petrunia
added a comment - Summarizing the report data:
DOUBLE_PREC_HB
"filtered": 3.846199989,
"r_filtered": 0,
JSON
"filtered": 93,
"r_filtered": 0,
If I try to remove the COMPRESSED attribute, I get this:
DOUBLE_PREC_HB
"filtered": 92.96875,
"r_filtered": 0,
JSON_HB
"filtered": 93,
"r_filtered": 0,
DOUBLE_PREC_HB becomes just as bad as JSON_HB. It looks like the good estimate in the original report has been an accident.
The column is actually too short to be compressed.
Status counters confirm this: no [de]compressions happen during the test run:
MariaDB [test]> show status like '%compressions';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Column_compressions | 0 |
| Column_decompressions | 0 |
+-----------------------+-------+
2 rows in set (0.003 sec)
Sergei Petrunia
added a comment - The column is actually too short to be compressed.
Status counters confirm this: no [de] compressions happen during the test run:
MariaDB [test]> show status like '%compressions';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Column_compressions | 0 |
| Column_decompressions | 0 |
+-----------------------+-------+
2 rows in set (0.003 sec)
The JSON_HB histograms are the same. The DOUBLE_PREC_HB histograms are different.
Compressed:
(I've done some manual reformatting to make the differences more apparent)
MariaDB [test]> select decode_histogram(hist_type,histogram) from save10;
Sergei Petrunia
added a comment - I compare the histograms that were produced when
the testcase used COMPRESSED column
the testcase didn't use COMPRESSED column.
The JSON_HB histograms are the same. The DOUBLE_PREC_HB histograms are different.
Compressed:
(I've done some manual reformatting to make the differences more apparent)
MariaDB [test]> select decode_histogram(hist_type,histogram) from save10;
0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.00000,0.04001,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.04001,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.04001,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.04001,
0.00000,0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.03999,
0.00000,0.00000,0.00000,0.00000,0.04001,
0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.04001,0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.04001,0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.00000,0.04001,0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.00000,0.04001,0.00000,0.00000,0.00000,0.03999,0.00000,0.00000,0.00000,0.04001,0.00000,0.00000,0.00000 |
Non-compressed:
MariaDB [test]> select decode_histogram(hist_type,histogram) from save12;
0.00000,0.00000,0.00000,0.04056,
0.00000,0.00000,0.00000,0.00000,0.03880,
0.00000,0.00000,0.00000,0.00000,0.00000,0.02292,
0.00000,0.00000,0.00000,0.00000,0.05292,
0.00000,0.00000,0.00000,0.00000,0.08112,
0.00000,0.00000,0.00000,0.00000,0.01411,
0.00000,0.00000,0.00000,0.00000,0.05644,
0.00000,0.00000,0.00000,0.00000,0.04585,
0.00000,0.00000,0.00000,0.00000,0.03703,
0.00000,0.00000,0.00000,0.00000,0.02998,
0.00000,0.00000,0.00000,0.00000,0.00000, 0.02293,
0.00000,0.00000,0.00000,0.00000,0.07936,
0.00000,0.00000,0.00000,0.00000,0.01587,
0.00000,0.00000,0.00000,0.00000,0.05290,
0.00000,0.00000,0.00000,0.00000,0.06526,0.00000,0.00000,0.00000,0.00000,0.02293,0.00000,0.00000,0.00000,0.00000,0.02116,0.00000,0.00000,0.00000,0.00000,0.07407,0.00000,0.00000,0.00000,0.00000,0.04233,0.00000,0.00000,0.00000,0.00000,0.00000,0.05115,0.00000,0.00000,0.00000,0.00000,0.06525,0.00000,0.00000,0.00000,0.00000,0.02293,0.00000,0.00000,0.00000,0.00000,0.01587,0.00000,0.00000,0.00000,0.00706,0.00000,0.00000,0.00000,0.02116,0.00000,0.00000,0.00000 |
The condition is impossible to satisfy but the optimizer doesn't recognize that.
The ranges it is estimating and the estimates:
DOUBLE_PREC_HB, non-COMPRESSED:
"rows_estimation": [
{
"selectivity_for_indexes": [],
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.9296875
}
],
"cond_selectivity": 0.9296875
},
DOUBLE_PREC_HB, COMPRESSED:
"rows_estimation": [
{
"selectivity_for_indexes": [],
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.038462
}
],
"cond_selectivity": 0.038462
},
JSON:
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.93
}
],
"cond_selectivity": 0.93
},
what would be the right selectivity for t.a >= 'c'? The two values that are less are aaaaa and bbbbb.
sel = (26 - 2)/26.= 0.92, which agrees with the JSON_HB selectivity.
Sergei Petrunia
added a comment - The condition is impossible to satisfy but the optimizer doesn't recognize that.
The ranges it is estimating and the estimates:
DOUBLE_PREC_HB, non-COMPRESSED:
"rows_estimation": [
{
"selectivity_for_indexes": [],
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.9296875
}
],
"cond_selectivity": 0.9296875
},
DOUBLE_PREC_HB, COMPRESSED:
"rows_estimation": [
{
"selectivity_for_indexes": [],
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.038462
}
],
"cond_selectivity": 0.038462
},
JSON:
"selectivity_for_columns": [
{
"column_name": "a",
"ranges": ["c <= a"],
"selectivity_from_histogram": 0.93
}
],
"cond_selectivity": 0.93
},
what would be the right selectivity for t.a >= 'c' ? The two values that are less are aaaaa and bbbbb.
sel = (26 - 2)/26.= 0.92, which agrees with the JSON_HB selectivity.
Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.
Julien Fritsch
added a comment - Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.
Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.
JiraAutomate
added a comment - Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.
Summarizing the report data:
DOUBLE_PREC_HB
"filtered": 3.846199989,
"r_filtered": 0,
JSON
"filtered": 93,
"r_filtered": 0,
If I try to remove the COMPRESSED attribute, I get this:
DOUBLE_PREC_HB
"filtered": 92.96875,
"r_filtered": 0,
JSON_HB
"filtered": 93,
"r_filtered": 0,
DOUBLE_PREC_HB becomes just as bad as JSON_HB. It looks like the good estimate in the original report has been an accident.