Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
Why would a SQL query take significantly longer to run when the row return limit is increased by 1?

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 enter image description here

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

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda