I have a sub-query that is being used in four different queries that all execute to present some dashboard like functionality. The common ground for all queries is this sub-query which I want to extract in a temporary table. This has been a success, but using Knex.js (which is amazing) the connections are pooled, which means that all the queries use different connections which again lead to the temporary table being dropped in between.
Is there any way to force using one connection, and one session in Knex this way? Or would I need to look for other workarounds, such as wrapping it all in a transaction?