You can use bulkinsert to insert huge amount of records, yes is fast. Also
if you are doing long time task, you can use "scheduler", to schedule your
task, if you need to inform to the client browser you can use tornado ,
there are an example using with web2py out there, or reload the page after
5 seconds for example to check if the task is done.

2012/2/7 LightOfMooN <vladsale...@yandex.ru>

> Hi
> Just download web2py, run it and go to edit welcome app.
>
> in db.py:
> db.define_table('mytable',Field('myfield','string'))
>
> in controllers/default.py:
> def index():
>    if request.vars.add_rows:
>        for i in xrange(100000):
>            db.mytable.insert(myfield='')
>    rows = db(db.mytable.id>0).select()
>    response.flash = "Welcome to web2py!"
>    return dict()
>
> in controllers/index.html:
> {{extend 'layout.html'}}
> <form method="POST">
>    <input type="submit" name="add_rows" value="add 100k rows" />
> </form>
>
>
>
> Let's test it.
> Click on "add_rows" button to insert 100000 rows in database.
> Then reload page.
> There are just one query, that gets us one set of 100k rows.
> Time to process query is less than 100ms, but page loads 5-6s!
> Nothing passed to the view.
>
> So, my question is:
>
> Is web2py can be used in production for big sites, or just for small-
> home-sites?
> thx
>



-- 
 http://www.tecnodoc.com.ar

Reply via email to