Quotessence
Home / Quotes / Quote / Image

Quote image editor Tim Woodruff

Back to previous page

“If your query returns a small number of rows but filters inefficiently, the database might still have to scan a large portion of the table and sort all those matching rows, which involves temporary memory, CPU, and often some significant amount of disk I/O - especially without an index on the field you're ordering by. Keep this in mind when considering whether to sort the results of your query using .orderBy() or .orderByDesc(), and be sure never to do so either willily, or nillily.” — Tim Woodruff

Quote 1080 x 1350 Instagram portrait
More
Platforms
Pure ratios
If your query returns a small number of rows but filters inefficiently, the database might still have to scan a large portion of the table and sort all those matching rows, which involves temporary memory, CPU, and often some significant amount of disk I/O - especially without an index on the field you're ordering by. Keep this in mind when considering whether to sort the results of your query using .orderBy() or .orderByDesc(), and be sure never to do so either willily, or nillily.
— Tim Woodruff