[web-devel] Database connection laziness (yesod)

Jeremy Hughes jedahu at gmail.com
Wed May 18 02:36:02 CEST 2011

Hi Felipe,

On Wed, May 18, 2011 at 12:25 PM, Felipe Almeida Lessa
<felipe.lessa at gmail.com> wrote:
> IIRC, runDB runs on a pool of DB connections, so it never creates a
> connection, it only grabs one connection from the pool.

Ah, yes. My mistake.

> That said,
> runDB needs to get a connection from the pool even if you don't use it
> all.  Also, it needs to start and commit a transaction (although I
> guess that drivers may optimize away the commit knowing that you
> didn't do anything).  So while a connection startup/teardown cycle
> won't be needed, you will need to use the resource that other thread
> could be using.
> Does that make sense?  I'm not sure if all I've said is correct, but I think so.

Makes sense to me.

More information about the web-devel mailing list