Scaling in the early days
Your app. is slow because your queries are slow.
In the early days, there are only two or three things you should do to scale your application (generally speaking).
- Add more cores and memory to the server
- minify assets css/js.
- index your queries.
But really, your app. is slow because your queries are slow.
Adding the right index made this query 11 times faster. Down to 74 millisecond from 944 milliseconds. Look at this beautiful query plan.
Don't get me started on what these queries do to your throughput.