Re: Limiting connection to mysql using old mysql module (not mysqli)

From: Date: Mon, 24 Sep 2007 01:24:10 +0000
Subject: Re: Limiting connection to mysql using old mysql module (not mysqli)
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-262402@lists.php.net to get a copy of this message
Per Jessen wrote:
Stut wrote:
Indeed, but only if you're making a lot of repetitive queries to the database.
Which is typically what a busy website does :-)
The query cache only works if you give it exactly the same query. That is: select blah from table where id=1; if it changes to select blah from table where id=2; then it's not fetched from the cache and thus hits the real data (this then gets cached in case it's called again next time). or even select blah, blah2 from table where id=1; will not hit the first cache because the fields are different. http://dev.mysql.com/doc/refman/4.1/en/query-cache-how.html
However, since the OP wants to reduce the number of connections to the database, query caching may reduce the time each connection is held for it will not reduce the overall number of connections.
The number of connections is presumably only important if we speak about the number of concurrent connections. If each query can be dealt with faster due to caching, the number of concurrent connections should drop.
Err no - it still has to connect to the database (thus use a connection slot) to even get to the cache. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#262402) next »