I have an app with following code:

    curr_val = db(db.pushes).select().last().kolik
    if db(db.pushes.created_on).select().last().created_on.date() < 
datetime.datetime.now().date():
        db.pushes.insert(kolik=1)
    else:
        db.pushes.insert(kolik=curr_val+1)

When DB gets to 6428 (last time I've checked) this took 9 seconds on mysql, 
after I deleted all records it ends up within 1 second. As the DB grows 
this code gets slower and slower.
Can someone point me as to what I am doing wrong?

-- 
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