这是代码:
using (var session = NHibernateSessionFactory.OpenSession()) // 0ms
{
using (var transaction = session.BeginTransaction()) // 0ms
{
session.Save(new Test() { Text = "..." }); // ~2ms
transaction.Commit(); // 100-150ms!!
}
}
日志输出:
...
2013-06-20 17:45:48,857 [DEBUG] [NHibernate.Impl.SessionImpl] - before transaction completion
2013-06-20 17:45:48,989 [DEBUG] [NHibernate.Transaction.AdoTransaction] - IDbTransaction Committed
...
为什么需要这么长时间?与 PostgreSQL 相同的代码会导致 ~5-10 毫秒...