是的。这句话我看到了。你的第一段代码是阻塞的,第二段是正常工作的。因为DBD::mysql本身就只支持一个连接一个异步。
DBD::mysql support only single asynchronous query per MySQL connection. To make it easier to overcome this limitation provided connect() constructor work using DBI->connect_cached() under the hood
作者是用了DBI的connect_cached来缓存数据库连接,所以有数据库连接的时候是不会每次都做连接的。缓存机制是有的。