title: Are Objection.js WHERE IN queries slowing my Node.js application down?
body: <p>Ok, so this is basically a yes/no answer. I have a node application running on Heroku with a postgres plan. I use Objection.js as ORM. <em>I'm facing 300+ms response times on most of the endpoints</em>, and I have a theory about why this is. I would like to have this confirmed.</p>
  
  <p>Most of my api endpoints do around 5-10 eager loads. Objection.js handles eager loading by doing additional WHERE IN queries and not by doing one big query with a lot of JOINS. The reason for this is that it was easier to build that way and that it shouldn't harm performance too much.</p>
  
  <p>But that made me thinking: Heroku Postgres doesn't run on the same heroku dyno as the node application I assume, so that means there is latency for every query. Could it be that all these latencies add up, causing a total of 300ms delay?</p>
  
  <p><strong>Summarizing</strong>: would it be speedier to build your own queries with Knex instead of generating them through Objection.js, in case you have a separately hosted database?</p>