News for hackers. Stuff that matters.
Re:How not to structure database-backed web apps: performanc... by olavk on Thursday June 28, 2018 @06:30AM (#17415634)
They require rather sophisticated analysis to detect. A compiler will detect trivial errors, but will not flag if you are using an O(n) algorithm when an O(1) could be used. Not yet, anyway.
Re:How not to structure database-backed web apps: performanc... by Arnt on Thursday June 28, 2018 @07:32AM (#17415960)
I read the paper. A third, maybe half of the stuff the ORMs didn't detect looks simple to detect.

(Greybeards may remember how perl's -W switch switch suddenly detected a frightful amount of performance problems using mostly simple tests. Almost 20 years ago now.)

Re:How not to structure database-backed web apps: performanc... by olavk on Thursday June 28, 2018 @07:48AM (#17416062)
Maybe you are on to something. All the major ORM's are open source (AFAIK) so if you made a write-up of the common issues and how you suggest they could be detected by the ORM, I think it would be very well received.
Re:How not to structure database-backed web apps: performanc... by vidarh on Thursday June 28, 2018 @10:45AM (#17417241)
I'd think you could do warnings on this simply by processing a log of the queries, looking for query patterns that match common poor code patterns.

E.g.

    SELECT id FROM table [some conditions]
followed by a number of

   SELECT * FROM table WHERE id = ...
 
is one example of a anti-pattern that suggests that someone is doing an overly simplistic query followed by a loop. Similar with signs of triggering loading of related objects instead of a JOIN.

Doing it on the emitted SQL would also make it quite easy to make it reasonably ORM agnostic - it doesn't need to be perfect, after all, so doing relatively crude pattern matching ought to be able to find at least the more basic problems.

Re:How not to structure database-backed web apps: performanc... by tonyarkles on Thursday June 28, 2018 @09:38AM (#17416723)
The authors of the paper, if I’m remembering from reading it earlier today, built a static analyzer to help find these types of problems! Some of the work has already been done!