php - Better close Pdo connection on no persistent connection? & Pdo Connection Performance -
php - Better close Pdo connection on no persistent connection? & Pdo Connection Performance -
i more used mysql_query
command pdo
ones, i'm going utilize them in new project.
i'd know if not persistent connection it's improve close connection or if doesn't create problem leave (like on mysql_query).
the sec question is: there difference on performance between finish pdo connector
$dbh = new pdo('mysql:host=localhost;dbname=test', $user, $pass);
and dbless one?
$dbh = new pdo('mysql:host=localhost', $user, $pass);
i need web application utilize more 1 db, i'd take set on each query dbname.dbtable , not open 2 or more connection each 1 on different db.
there other ways eventually?
the connection automatically closed @ end of script (or when $dbh
gets unset or falls out of scope). that's same ext/mysql , virtually other database connectors. close connection manually when know you're done free minimal resources may take up, in practice it's hardly worth it. the thing dbname
tell database server database want use. difference makes not need utilize db.table.column
format every time refer table, can utilize table.column
, understand database you're talking about. there's no performance difference worth mentioning.
php
Comments
Post a Comment