I have a web application that runs some database queries to fulfil some request. I am using aka http along with Slick(with HikariCP). I have used for comprehension to make sure these queries run in parallel. However, when I run it I see that only 1 connection is used to run all queries. What I want is the queries to run in parallel on the db i.e. use a separate connection.
eventFilter : DBIO[] = ??
vendorFilter : DBIO[] = ??
val flags = for {
event <- eventFilter
vendor <- vendorFilter
} yield (event, vendor)
Here eventFilter and vendorFilter are database actions that would be run in separate threads. However they are using the same connection to the database. I want to use separate connections so that the queries could actually run in parallel. I am using HikariCP that has 20 connections in idle state. I was hoping I could use them.
Is my understanding correct? Any idea as to how I can implement this. Any changes in Hikari config that could help bring this change. Also please point out any drawbacks related with this approach. Thanks.