Re: [web2py] Re: db.commit() taking too long to update records

2014-10-24 Thread Luciano Laporta Podazza
Thanks for the headsup Anthony!, luckly it's not my case. Cheers! On Thu, Oct 23, 2014 at 2:18 PM, Anthony wrote: > On Thursday, October 23, 2014 12:52:33 PM UTC-4, Leonel Câmara wrote: >> >> Doesn't the database take care of that? I mean isn't db session handling >> inside a transaction anyway

[web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Anthony
On Thursday, October 23, 2014 12:52:33 PM UTC-4, Leonel Câmara wrote: > > Doesn't the database take care of that? I mean isn't db session handling > inside a transaction anyway? > Yes, but that doesn't help across requests (e.g., request A reads session > request B reads session > request A upda

[web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Leonel Câmara
Doesn't the database take care of that? I mean isn't db session handling inside a transaction 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

Re: [web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Anthony
Keep in mind that the benefit of locking the session is that you avoid race conditions, so you now have to make sure there is no possibility of a race condition with the session if you have multiple calls happening asynchronously. The other option is to continue using file base sessions, but ca

Re: [web2py] Re: db.commit() taking too long to update records

2014-10-23 Thread Luciano Laporta Podazza
Hi Anthony!, Indeed, the ajax call was the issue, after reading this: http://web2py.com/books/default/chapter/29/04#session I realised that storing sessions in database solved my problem(there's no more blocking calls issue). Thanks a lot for your help Cheers. On Thu, Oct 23, 2014 at 1:01 A

[web2py] Re: db.commit() taking too long to update records

2014-10-22 Thread Anthony
Instead of checking the timings in the console, check the timings during the actual Ajax request (maybe return the timings in some HTML and display it in the browser instead of just returning "OK"; or print the timings to the console). Are there any other Ajax requests that get fired before thi

Re: [web2py] Re: db.commit() taking too long to update records

2014-10-22 Thread Luciano Laporta Podazza
By the way, I've already tried the SQL query manually and it works perfectly. I'm using Web2py 2.9.11 and I'm starting to think that perhaps there's an issue with web2py services. Any ideas?. Thanks On Wed, Oct 22, 2014 at 10:30 PM, Luciano Laporta Podazza < lucianopoda...@gmail.com> wrote: > Hi

[web2py] Re: db.commit() taking too long to update records

2014-10-22 Thread Luciano Laporta Podazza
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.archive

[web2py] Re: db.commit() taking too long to update records

2014-09-10 Thread Niphlod
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

[web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Leonel Câmara
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

Re: [web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Luciano Laporta Podazza
Perhaps I misunderstood this, but following the web2py manual it says that no recordset is updated until you do db.commit(). Is that right?. On Tue, Sep 9, 2014 at 7:29 PM, villas wrote: > If this is in a controller, do you need the line: db.commit() ?? > > -- > Resources: > - http://web2py

[web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread villas
If this is in a controller, do you need the line: db.commit() ?? -- 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

Re: [web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Luciano Laporta Podazza
Thanks for your help Leonel. I didn't tried it but I'm talking about a dead simple db structure, it's just updating a few records( like 10 rows or so) on a single table. On Tue, Sep 9, 2014 at 7:24 PM, Leonel Câmara wrote: > Then I'm sorry but I have no idea why it's taking so long. You need t

[web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Leonel Câmara
Then I'm sorry but I have no idea why it's taking so long. You need to profile it. It may just be a question of tuning MySQL, optimizing the tables, etc. Have you tried mysqltuner? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (So

Re: [web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Luciano Laporta Podazza
Sorry, I forgot to mention that I'm using MySQL as db engine. Thanks. On Tue, Sep 9, 2014 at 6:45 PM, Leonel Câmara wrote: > My guess would be that you're using sqlite and the database is locking > you. Which is easy to happen if you have a few people requesting updates > every 5 seconds and yo

[web2py] Re: db.commit() taking too long to update records

2014-09-09 Thread Leonel Câmara
My guess would be that you're using sqlite and the database is locking you. Which is easy to happen if you have a few people requesting updates every 5 seconds and you're trying to write on it, as the write will only go forward once sqlite gets its process an EXCLUSIVE lock which requires all re