News for hackers. Stuff that matters.
Re:Efficient GraphQL Queries in Ruby on Rails and Postgres by X6S1x6Okd1st on Wednesday September 25, 2019 @03:45PM (#21074537)
Just because there are few users doesn't mean inefficiency is fine.
Re:Efficient GraphQL Queries in Ruby on Rails and Postgres by imtringued on Thursday September 26, 2019 @07:07AM (#21079845)
It is because there is no reason why you should waste your time optimizing a page with a heavy query (with thousands of inserts) from 10 seconds to the theoretical 6 seconds that are possible if its only going to be used 20 times and the rest of the time it's simply loading the last cached result?

Also from my experience the performance problems are completely divorced from ORM/not ORM. Usually the reason why you drop the ORM is that you want to take advantage of features that are not modeled by the ORM. Most query optimizations simply involve trying to do everything in as big of a batch as possible. Whether you do batching with or without the ORM isn't really relevant. The reason why people don't batch their queries when they use ORMs is because it's so trivial to not do so but there is no reason why we can't build better ORMs that make batched queries as easy to use as non batched queries which would get us both performance and convenience at the same time.

Re:Efficient GraphQL Queries in Ruby on Rails and Postgres by cuddlecake on Wednesday September 25, 2019 @04:03PM (#21074710)
On the other hand, it also does not mean that inefficiency to some degree is not acceptable.

And if it is not acceptable, you can still optimize the living excrements out of your GraphQL resolvers.

Also, the burden of doing more than one round trip usually moves to the client. So there's always some trade-off to be made.

Re:Efficient GraphQL Queries in Ruby on Rails and Postgres by aidos on Wednesday September 25, 2019 @03:59PM (#21074672)
There are different types of inefficiency and being inefficient in one area might be worth the trade off to be efficient in another. Also, multiple dB queries really aren’t the end of the world.