[MDEV-29216] Log Queries without Indexes - Ignore those where just the "wrapping" SELECT doesn't use index Created: 2022-07-30  Updated: 2022-08-01

Status: Open
Project: MariaDB Server
Component/s: Server
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Nuno Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: slow_query_log

Attachments: PNG File image-2022-07-30-18-54-05-263.png     PNG File image-2022-07-30-18-54-45-956.png     PNG File image-2022-07-30-18-57-14-047.png    

 Description   

Consider queries like these:

(SELECT ...) UNION ALL (SELECT ...) UNION ALL (SELECT ...) ORDER BY ... DESC

SELECT * FROM (SELECT ...) AS `t` ORDER BY ... ASC

And something more complex, like a mix of the above:

All these queries are logged when I have not_using_index in log_slow_filter.

I believe these queries are optimized as they can be, and I can't really make those "wrapping SELECTs" use indexes. (except, I believe, if I put the results in temporary tables with indexes, which seems overkill to me)

Having these appearing in the Slow Log creates a lot of noise that doesn't let me focus on other queries that really need to be fixed.

I wonder if it would make sense to add an extra filter so that these "false positives" are not included, what do you think?

Something like "not_using_index_notderived" or "not_using_index_realtables" (just random suggestions)

Thank you very much.


Generated at Thu Feb 08 10:06:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.