2
我想从多个数据库表中的数据,并希望在五年多的表使用select查询,使用事务查询性能提高的帮助:MySQL事务性查询是否可以提高多个SELECT语句的性能?
try {
// First of all, let's begin a transaction
$this->db->beginTransaction();
// Multiple select queries
$this->db->commit();
return $data;
} catch (Exception $e) {
// An exception has been thrown
// We must rollback the transaction
$this->db->rollback();
}
不,它不会加快速度,因为MySQL现在必须管理事务上下文以及选择,因此您正在执行更多操作。除了这些读取查询索引和适当的查询方法会更重要。 – Namphibian