mysql select some sort of caching

Gabriel Genellina gagsl-py2 at
Thu Oct 22 06:30:52 CEST 2009

En Wed, 21 Oct 2009 22:24:49 -0300, David Sfiligoi <sfiligoi at>  

> On Wed, 21 Oct 2009 00:45:21 -0300, Gabriel Genellina wrote:
>> If you want to keep the cursor open, you must commit the (implicit)
>> current transaction, even if it only contains selects (a rollback would
>> work too).
>> Alternatively, lower the transaction isolation level below "repeatable
>> reads". Note that in other scenarios, ensuring that the same query
>> returns the same results is a Good Thing.
> Thanks Gabriel,  I tried the commit suggestion and it works.  I was
> thinking that everytime I made a select query and if the data changed
> between the select query(like anohter application updating a field and
> commiting the transaction), the select query routing inside the database
> engine would recognised that the data is no longer the same as the
> previous exact same query and would return me the new data.

Yes, this is known as "phantom read", and may happen depending on the  
transaction isolation level currently in effect.  Although in your use  
case it may be a desirable feature, in other cases it's not. See

Gabriel Genellina

More information about the Python-list mailing list