Hi Niphlod,

I did what you say and if I try doing the query through console it works 
perfectly and fast:

>>> db._timings 

[('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), ("SET 
sql_mode='NO_BACKSLASH_ESCAPES';", 0.0002338886260986328)] 

>>> db((db.alerts.alerts_id==1)&(db.alerts.archived != True)).update(
archived=True, crime="Robo", operator_id=1) 

23 

>>> db._timings 

[('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), ("SET 
sql_mode='NO_BACKSLASH_ESCAPES';", 0.0002338886260986328), ("UPDATE alerts 
SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) 
AND (alerts.archived <> 'T'));", 0.010937213897705078)] 

>>> db.commit() 

>>> db._timings 

[('SET FOREIGN_KEY_CHECKS=1;', 0.0002541542053222656), ("SET 
sql_mode='NO_BACKSLASH_ESCAPES';", 0.0002338886260986328), ("UPDATE alerts 
SET archived='T',operator_id=1,crime='Robo' WHERE ((alerts.alerts_id = 1) 
AND (alerts.archived <> 'T'));", 0.010937213897705078)]

But again, if I try sending the ajax request(a simple one, really), it gets 
stucked as I mentioned before, then after 20-30seconds the record gets 
updated.

I'm using MySQL 5.5 with less than 50 records on the affected table.

Any help will be appreciated. Thanks

On Wednesday, September 10, 2014 6:20:47 AM UTC-3, Niphlod wrote:
>
> BTW, log somewhere db._timings before returning and try to replay the 
> query in mysql to see what's going on.
>
> On Wednesday, September 10, 2014 12:54:03 AM UTC+2, Leonel Câmara wrote:
>>
>> Well that's true, but web2py automatically calls db.commit for you after 
>> running the controller. That would not cause the slowdown anyway.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to