I'm using loop for 100000 inserts just one time to insert 100k records in database. All next time I just try to get response. And now in our project we have much more than 100k records, that can be filtered and sorted by some dinamic conditions.
On 7 фев, 12:27, Bruce Wade <bruce.w...@gmail.com> wrote: > You are using a for loop with 100000 inserts it is the for loop holding you > up not web2py. Plus who in their right mind would code something like that > in production > On Feb 6, 2012 11:24 PM, "LightOfMooN" <vladsale...@yandex.ru> wrote: > > > > > > > > > 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