MySQL Forums
Forum List  »  Stored Procedures

Help with EXPLAIN
Posted by: John Noble
Date: September 17, 2026 06:06AM

Hi there,

I have a large complicated stored procedure that appears to be running quite slow. When I use the EXPLAIN keyword, I get the following feedback...


id,select_type,table,type,possible_keys,key,key_len,ref,rows,Extra
1,PRIMARY,<derived2>,ALL,NULL,NULL,NULL,NULL,4443,"Using filesort"
2,DERIVED,salesledger,range,"doctype,invoiceDate,paidinfulldate",paidinfulldate,4,NULL,4461,"Using where; Using temporary; Using filesort"
2,DERIVED,receipts,ref,invNum,invNum,4,sst.salesledger.invNum,1,
2,DERIVED,customers,ref,customerID,customerID,9,sst.salesledger.customerID,1,
2,DERIVED,groups,ALL,NULL,NULL,NULL,NULL,19,
2,DERIVED,users,ref,userID,userID,5,sst.salesledger.CCmanagerID,1,
2,DERIVED,countries,ref,countryID,countryID,4,sst.salesledger.countryID,1,
3,UNION,salesledger,range,"doctype,invoiceDate,paidinfulldate",paidinfulldate,4,NULL,4461,"Using where; Using temporary; Using filesort"
3,UNION,receipts,ref,paymentNo,paymentNo,4,sst.salesledger.paymentNo,1,
3,UNION,customers,ref,customerID,customerID,9,sst.salesledger.customerID,1,
3,UNION,groups,ALL,NULL,NULL,NULL,NULL,19,
3,UNION,users,ref,userID,userID,5,sst.salesledger.CCmanagerID,1,
3,UNION,countries,ref,countryID,countryID,4,sst.salesledger.countryID,1,
4,UNION,salesledger,ref,"invNum,invoiceDate,paidinfulldate",invNum,4,,1914,"Using where; Using temporary; Using filesort"
4,UNION,customers,ref,customerID,customerID,9,sst.salesledger.customerID,1,
4,UNION,groups,ALL,NULL,NULL,NULL,NULL,19,
4,UNION,users,ref,userID,userID,5,sst.salesledger.CCmanagerID,1,
4,UNION,countries,ref,countryID,countryID,4,sst.salesledger.countryID,1,
4,UNION,receipts,ALL,receiptDate,NULL,NULL,NULL,571339,"Using where; Using join buffer"
NULL,"UNION RESULT","<union2,3,4>",ALL,NULL,NULL,NULL,NULL,NULL,

Sorry, but I cannot see how to format the results.


The last entry shows rows as 571339. The posibble_keys is showing as receiptDate. However, there is already an index on Receipts.receiptDate but the key column is showing as null ??

Can anyone advise ?

Thanks,

John

Options: Reply• Quote


Subject
Views
Written By
Posted
Help with EXPLAIN
201
September 17, 2026 06:06AM
118
September 17, 2026 07:52AM
106
September 18, 2026 07:21AM
114
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.