Re: Help with EXPLAIN
The important part of the last 'receipts' row is:
type = ALL
possible_keys = receiptDate
key = NULL
rows = 571339
Extra = Using where; Using join buffer
'possible_keys' only means MySQL considers the 'receiptDate' index potentially usable. 'key = NULL' means the optimizer decided not to use it for this particular query.
This can happen when MySQL estimates that scanning the table is cheaper than using the index, especially if the condition matches a large portion of the 571k rows. The join condition and the actual 'WHERE' clause are also important here.
I would start by checking the actual query and running:
ANALYZE TABLE receipts;
Then run 'EXPLAIN ANALYZE' on the relevant SELECT if you're using a MySQL version that supports it. That will show actual execution statistics rather than only the optimizer's estimates.
The stored procedure itself isn't enough to determine whether 'receiptDate' needs a different index. The actual SELECT, WHERE conditions, JOIN conditions, and table/index definitions would be needed to recommend a specific index.
Please let me know if the suggestion helped you.
Subject
Views
Written By
Posted
189
September 17, 2026 06:06AM
Re: Help with EXPLAIN
109
September 17, 2026 07:52AM
98
September 18, 2026 07:21AM
108
September 18, 2026 07:36AM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.