【发布时间】:2011-10-18 08:26:27
【问题描述】:
在 Postgres 中使用准备好的语句时,我有一些查询要慢得多(这是一个已知问题,请参阅 http://www.postgresql.org/docs/current/static/sql-prepare.html)。因此,我想关闭这些查询的语句准备。
在 DBIx::Class 中,通过在 connect_info 中传递参数“pg_server_prepare => 0”,我可以在连接到数据库时全局关闭准备好的语句。但我看不到如何为现有连接更改此设置。给定一个 DBIx::Class::Schema,我试过这个:
$schema->storage->connect_info->[0]->{'pg_server_prepare'} = 0;
如果我在该调用之后记录 connect_info,我会看到此参数的新值,但数据库驱动程序仍使用预准备语句。我也尝试断开连接并重新连接
$schema->storage->connect_info->[0]->{'pg_server_prepare'} = 0;
$schema->storage->disconnect;
$schema->connect(@{ $schema->storage->connect_info->[0] });
但这也无济于事。
有什么想法吗?
【问题讨论】:
标签: postgresql perl dbix-class