Details
Description
When set it on my.cnf
[mysqld]
slow_query_log=ON
log_queries_not_using_indexes=OFF
log_slow_filter=
Run query
create database slow;
|
create table slow.t(int id, int k);
|
insert into slow.t values (1, 1);
|
insert into slow.t values (2, 2);
|
select * from slow.t;
|
Then the query not using indexes will be logged into slow log. The is a wrong behavior due to document and is different from previous version like 10.2.
Analysis
On file sql_parse.cc
if ((thd->server_status & |
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
|
!(thd->query_plan_flags & QPLAN_STATUS) &&
|
!slow_filter_masked(thd, QPLAN_NOT_USING_INDEX))
|
{
|
thd->query_plan_flags|= QPLAN_NOT_USING_INDEX;
|
/* We are always logging no index queries if enabled in filter */ |
thd->server_status|= SERVER_QUERY_WAS_SLOW;
|
}
|
The slow_filter_masked is
static bool slow_filter_masked(THD *thd, ulonglong mask) |
{
|
return thd->variables.log_slow_filter && !(thd->variables.log_slow_filter & mask); |
}
|
Which means the function return false when `log_slow_filter` is 0, which is set when in config it is a empty string. And then log_queries_not_using_indexes=OFF does not work and always log the not using indexes queries.
Attachments
Issue Links
- links to
Activity
Field | Original Value | New Value |
---|---|---|
Affects Version/s | 10.3 [ 22126 ] | |
Affects Version/s | 10.4 [ 22408 ] |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Sergei Golubchik [ serg ] |
Summary | log_query_not_using_indexes=OOF does not work when log_slow_filter is empty string | log_query_not_using_indexes=OFF does not work when log_slow_filter is empty string |
Workflow | MariaDB v3 [ 101509 ] | MariaDB v4 [ 144198 ] |
Remote Link | This issue links to "SO post - same issue (Web Link)" [ 34666 ] |
Assignee | Sergei Golubchik [ serg ] | Daniel Black [ danblack ] |
Assignee | Daniel Black [ danblack ] | Michael Widenius [ monty ] |
Status | Confirmed [ 10101 ] | In Review [ 10002 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
issue.field.resolutiondate | 2022-12-13 23:16:38.0 | 2022-12-13 23:16:38.209 |
Fix Version/s | 10.3.38 [ 28507 ] | |
Fix Version/s | 10.4.28 [ 28509 ] | |
Fix Version/s | 10.5.19 [ 28511 ] | |
Fix Version/s | 10.6.12 [ 28513 ] | |
Fix Version/s | 10.7.8 [ 28515 ] | |
Fix Version/s | 10.8.7 [ 28517 ] | |
Fix Version/s | 10.9.5 [ 28519 ] | |
Fix Version/s | 10.10.3 [ 28521 ] | |
Fix Version/s | 10.11.2 [ 28523 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Assignee | Michael Widenius [ monty ] | Daniel Black [ danblack ] |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Thanks! I reproduced as described on current 10.3, 10.4