I have this sql query in my code (php)
SELECT * FROM (
SELECT
A.ID,
A.ID as QuoteID,
A.Price as QuotePrice,
A.Price_Per,
A.Currency,
P.Packaging,
A.PackagingID,
A.Quantity,
A.MOQ,
A.QuoteDate,
A.IncoTerm,
A.RefNO,
B.E_name,
B.C_name,
B.Type,
B.Form,
B.Dosage,
B.ProductID,
C.E_Name as SupplierName,
C.SupplierID,
A.Remark
FROM quote A
left join prodpackaging P on A.PackagingID = P.PackagingID
join product B on A.ProductID = B.ProductID
join supplier C on A.SupplierID = C.SupplierID
left join rfq r on r.RefNO = A.RefNO and r.RefNO like 'PL%'
WHERE IFNULL(r.status,'Valid') = 'Valid'
) oph;
This is not getting results in my local application. I checked it on phpMyAdmin and run it there, so this error is displayed
Error Code: 126. Incorrect key file for table '/tmp/#sql_4a9_0.MYI'; try to repair it
I saw this is a very common problem with the size of the query result and the /tmp folder size. I have tried these things:
1.- Changing system variables (join_buffer_size, sort_buffer_size, tmp_table_size, max_heap_table_size).
2.- Releasing space in disk.
Unfortunately, i couldn't solved this problem yet. Probably i need to improve the sql query or add more space to the /tmp folder, maybe any of these ways work. I'll really appreciate your help.
Thanks for your time.
Note, i attached the df -h command and the ncdu of "/":