4 ms·
99% of the time, it's either a quadratic (or exponential) algorithm or a really bad DB query.
by antisthenes 2y ago
99% of the time, it's either a quadratic (or exponential) algorithm or a really bad DB query.
- dd82 2y agocan also be a linear algorithm that does N+1 queries. ORMs can be very good at hiding this implementation detail
- Quekid5 2y ago> a linear algorithm that does N+1 queries. That's what quadratic means.
- sgerenser 2y agoTypically implemented accidentally: https://www.tumblr.com/accidentallyquadratic https://www.tumblr.com/accidentallyquadratic
- jon_richards 2y agoNot really what they're talking about https://stackoverflow.com/questions/97197/what-is-the-n1-selects-problem-in-orm-object-relational-mapping https://stackoverflow.com/questions/97197/what-is-the-n1-sel...
- nwellnhof 2y agoNo, N+1 is still linear.
- DylanSp 2y agoIt wasn't a financial cost, but the biggest single performance improvement I've seen firsthand came from optimizing a SQL query. One of our Professional Services people had written a query that did repeated self-joins on a fairly large table, which took ~15 minutes to run. A DBA-turned-dev on our team rewrote it using MSSQL's PIVOT operator, and the query started executing in less than a second.