When running the following query:
SELECT customers.ID, customers.FNAME, customers.MNAME, customers.LNAME,
customers.SUFFIX, addresses.ADDRESS, addresses.CITY, addresses.STATE,
addresses.ZIP
from db_name.customers
INNER JOIN db_name.addresses ON customers.ID=addresses.CID
limit 6607;
while connected to a MariaDB instance on AWS RDS from MySQL workbench, the query runs with the following metadata results:
6607 row(s) returned Duration: 0.507 sec / Fetch Time: 8.524 sec
Additionally, when the results are exported to a csv file, the size is about 466KB. However, when I run the same query with only changing the last line to retrieve one more row:
limit 6608
The query does not finish (I killed it after nearly an hour).
Furthermore, I noticed that the Fetch Time experiences a big jump between limit 4000 and limit 4001 rows.
Whether this insight useful or not, I have included a graph of fetch times (fetch time on the vertical axis) while varying the row limit (number of rows returned on the horizontal axis). I do not understand why fetch time appears to be a piecewise continuous (linear) function of rows returned:
Fetch time by row limit scatter plot

If anyone has an idea about what is preventing me from returning more than 6607 rows, I would love your advice. Thank you!