Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created February 9, 2024 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spetrunia/1f0b7a407c211c499122fb107adbe16e to your computer and use it in GitHub Desktop.
Save spetrunia/1f0b7a407c211c499122fb107adbe16e to your computer and use it in GitHub Desktop.
--- /tmp/log-on.txt 2024-02-09 13:07:36.292363361 +0300
+++ /tmp/log-off.txt 2024-02-09 13:08:34.117609771 +0300
@@ -1,3 +1,6 @@
+MariaDB [test]> set optimizer_use_condition_selectivity=1;
+Query OK, 0 rows affected (0.000 sec)
+
MariaDB [test]> SET optimizer_trace='enabled=on';
Query OK, 0 rows affected (0.000 sec)
@@ -207,12 +210,12 @@
| 199 | 124 | 20 |
| 200 | 31 | 8 |
+-----+-----------+-------------+
-201 rows in set (0.276 sec)
+201 rows in set (0.283 sec)
MariaDB [test]> select * from information_schema.optimizer_trace limit 1;
| SELECT sql_no_cache a.c3, SUM(a.c7), COUNT(a.c1)FROM tab1 a WHERE a.c2='c2_01' GROUP BY a.c3 | {
"steps": [
{
@@ -330,16 +333,6 @@
"cause": "not applicable aggregate function"
}
}
- },
- {
- "selectivity_for_indexes": [
- {
- "index_name": "indx01",
- "selectivity_from_index": 0.20412329
- }
- ],
- "selectivity_for_columns": [],
- "cond_selectivity": 0.20412329
}
]
},
@@ -466,7 +459,7 @@
}
]
} | 0 | 0 |
1 row in set (0.001 sec)
MariaDB [test]>
@@ -476,6 +469,10 @@
+------+-------------+-------+-------+---------------+--------+---------+------+-------+----------+----------+------------+-------------+
| 1 | SIMPLE | a | index | indx01 | indx02 | 4 | NULL | 14697 | 15000.00 | 20.41 | 20.00 | Using where |
+------+-------------+-------+-------+---------------+--------+---------+------+-------+----------+----------+------------+-------------+
-1 row in set (0.276 sec)
+1 row in set (0.281 sec)
MariaDB [test]> notee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment