Hi guys. I would like to understand a couple of scenarios with ecto. (assume they are not tests)
1 - Let’s imagine I have one single query and run this query inside 5 different processes at the same time. What happens? I’ll get 5 different connections from the pool to execute each one or I’ll share the same connection among 5 processes?
2 - Let’s imagine I have the same situation above, but this time I run those 5 processes inside one single transaction. What happens?
3 - Can I assume a transaction can share the same connection among all queries inside of it?
4 - If I use Task.async_stream/3 to run 5 different queries into 5 different processes. This function is going to consume 5 connections from the pool or share the same for each item in the enumerable?
5 - Repo.stream creates a lazy way to run queries, but imagine I have 200 records and my max_rows argument is equal to 100. What happens? I’ll hit the database twice to get 100 records each?
6 - if I use Task.async_stream/3 with Repo.stream. Would this increase the performance in those scenarios ?
Thank you guys!