Fork me on GitHub
#pathom
<
2022-09-22
>
Mark Wardle11:09:38

In relation to batching, I have a large number of encounters, each of which have to-many relationships to a number of 'forms' containing data items. So, I am dealing with the n+1 problem at the moment. My issue is that I'm not aware that my SQL "IN" can return the results in the correct order. Is there a clever way of using SQL to return ordered results for an "IN", or do I group the results and then re-order based on the original order using clojure - I'm thinking to group, and then a reduce across the original sequence of identifiers in order to lookup the results?

wilkerlucio12:09:13

there is a helper called restore-order that can help, check: https://pathom3.wsscode.com/docs/resolvers/#matching-results

👍 1
☯️ 1
Mark Wardle13:09:17

Thanks Wilker!

🙏 1