RE: General Mysql Connect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
> a new connection, but in terms of op codes, a new connection is
created.

no idea why your going on about op codes, and no a new connection is not
made - there is merely switching between DBs on a single connection.
it's the same as connecting with the mysql cmdline util and being able
to browse any db by simply performing 'USE <DB>' queries ... those
queries don't cause the mysql client to open new connections.
[/snip]

Exactly. One connection, no new overhead.

A few years ago, and I think it was on this list, someone gave what I
consider to be some sage advice; "allow the database to do all of the
work that it can do before applying any PHP to it".

If you use explicit database.table names in your queries it is placing
the workload on the database engine rather than making a function call
in PHP that essentially issues a USE <db> function call on the database.
You're using 2 functions (and at least one additional line of code) to
achieve what you could have achieved by stating the database name in the
query.

Like Jochem, I am unsure why you're going smackers over op code unless
your systems are antiquated or under-performing. We quit counting clock
cycles a long time ago. Is it because your application has a ton of
users with lots of connections? If so you may want to look into
connection pooling for the database.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux