 |
|
 |
|
Next: ###########Need consultants who r willing to appp..
|
| Author |
Message |
External

Since: Jan 09, 2008 Posts: 6
|
(Msg. 1) Posted: Wed Jan 09, 2008 8:49 am
Post subject: PHP Mysql query caching - how to stop it Archived from groups: alt>php>sql (more info?)
|
|
|
I have recently recognized a problem, described it in a post a few
hours ago, but have revised my opinion on the problem. Now it looks as
follows:
The portal runs on apache/php/mysql. Php generates a query, and the
result returned is from a cache, not from the actual mysql db. The
data I receive is not up-to-date - to changes I make during this
time.
I have tried using mysql_unbuffered_query, but doesn't help.
I have finally come to the solution. At the end of list of fields
following SELECT statement, I entered rand() function which causes
that every query is different from the previous...
Looks like this: SELECT field1,field2,...,rand() FROM ...
But this solution is ugly and very unproffesional.
Do you have any better idea?
How to stop php/apache from buffering/caching mysql query results?
Thanks for any hints
Michal >> Stay informed about: PHP Mysql query caching - how to stop it |
|
| Back to top |
|
 |  |
External

Since: Apr 16, 2007 Posts: 40
|
(Msg. 2) Posted: Wed Jan 09, 2008 11:28 am
Post subject: Re: PHP Mysql query caching - how to stop it [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jan 9, 8:49 am, michalk... DeleteThis @o2.pl wrote:
>
> The portal runs on apache/php/mysql. Php generates a query, and the
> result returned is from a cache, not from the actual mysql db. The
> data I receive is not up-to-date - to changes I make during this
> time.
> I have tried using mysql_unbuffered_query, but doesn't help.
> I have finally come to the solution. At the end of list of fields
> following SELECT statement, I entered rand() function which causes
> that every query is different from the previous...
> Looks like this: SELECT field1,field2,...,rand() FROM ...
>
> But this solution is ugly and very unproffesional.
> Do you have any better idea?
> How to stop php/apache from buffering/caching mysql query results?
Query caching is a MySQL-level setting; PHP and Apache have nothing to
do with it.
You have two options. One is to stop query caching entirely by
setting query_cache_type = 0 or query_cache_type = OFF in MySQL's
configuration file:
http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html#op...n_mysql
If you have no access to MySQL's configuration file, you can add a
SQL_NO_CACHE clause to your queries to request that MySQL run the
query rather than return a cached result:
SELECT SQL_NO_CACHE * FROM myTable;
See MySQL documentation:
http://dev.mysql.com/doc/refman/4.1/en/select.html
Cheers,
NC >> Stay informed about: PHP Mysql query caching - how to stop it |
|
| Back to top |
|
 |  |
External

Since: Jan 09, 2008 Posts: 6
|
(Msg. 3) Posted: Thu Jan 10, 2008 1:38 am
Post subject: Re: PHP Mysql query caching - how to stop it [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On 9 Sty, 20:28, NC wrote:
> On Jan 9, 8:49 am, michalk... RemoveThis @o2.pl wrote:
>
>
>
> > The portal runs on apache/php/mysql. Php generates a query, and the
> > result returned is from a cache, not from the actual mysql db. The
> > data I receive is not up-to-date - to changes I make during this
> > time.
> > I have tried using mysql_unbuffered_query, but doesn't help.
> > I have finally come to the solution. At the end of list of fields
> > following SELECT statement, I entered rand() function which causes
> > that every query is different from the previous...
> > Looks like this: SELECT field1,field2,...,rand() FROM ...
>
> > But this solution is ugly and very unproffesional.
> > Do you have any better idea?
> > How to stop php/apache from buffering/caching mysql query results?
>
> Query caching is a MySQL-level setting; PHP and Apache have nothing to
> do with it.
>
> You have two options. One is to stop query caching entirely by
> setting query_cache_type = 0 or query_cache_type = OFF in MySQL's
> configuration file:
>
> http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.html#o...
>
> If you have no access to MySQL's configuration file, you can add a
> SQL_NO_CACHE clause to your queries to request that MySQL run the
> query rather than return a cached result:
>
> SELECT SQL_NO_CACHE * FROM myTable;
>
> See MySQL documentation:
>
> http://dev.mysql.com/doc/refman/4.1/en/select.html
>
> Cheers,
> NC
Thanks, this helps!
Michal >> Stay informed about: PHP Mysql query caching - how to stop it |
|
| Back to top |
|
 |  |
| Related Topics: | MySQL Query - If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or her name, email, and age - but AGE is optional. My insert would look something like: INSERT INTO data (Name,....
mysql query - Hi need help My english is not good so ill be short. This is my database in mysql create table customers ( customerid int unsigned not null auto_increment primary key, name char(40) not null, address char(40) not null, city char(20) not null, ...
PHP/MySQL query time - PHP/MySQL query - time taken. MySQL reports how long each query takes, is this available to PHP, because if it is, it's not documented in the book I have, or I don't know what I'm looking for. I would like to play with some LIKE queries, but would lik...
mysql query optimization - Hi all! I stumbled across this query that I just can't optimize - even if I create all possible indexes it doesn't use them. Could someone please clue me in? I have no idea why MySQL doesn't use the indexes. :( The query in question is: mysql> expl...
Mysql Query Question - Im trying to write the following query to do the following but im not sure about the right way to do it I want to get back all the results minus any results that are within the 3 minutes of each other containing the same ip address, and same owner.. |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|