Re: [web2py] DAL speed - an idea

2012-02-10 Thread nick name
There's a tree structure among the record, upon which the aggregation is computed. Some dbs (e.g. oracle) have extensions for tree-like structures (CONNECT BY etc), but it is not standard, and I need to support both sqlite and postgres in this app.

[web2py] DAL speed - an idea

2012-02-09 Thread nick name
One of my controllers need to go through a lot of records to provide a meaningful answer -- as in, 60k records. Just loading them from the database takes about 100ms (db.executesql(select * from table order by id;)); Doing the same through DAL takes over 6 seconds. I realize that the DAL does

Re: [web2py] DAL speed - an idea

2012-02-09 Thread Bruno Rocha
You mean using the generated SQL command to fire execute_sql and returns as a named tuple? db(db.query).raw_select() it is the same as doing command = db(db.query)._select() result = db.execute_sql(command) On Thu, Feb 9, 2012 at 4:51 PM, nick name i.like.privacy@gmail.comwrote: One of

Re: [web2py] DAL speed - an idea

2012-02-09 Thread nick name
Yes, that is the basis of what I am suggesting. There is not currently such a thing; there is something called 'select_raw' implemented in the GoogleDataStore adapter, but not in anything else, and it isn't exactly what I am proposing. To elaborate: Assume the table is defined as follows:

Re: [web2py] DAL speed - an idea

2012-02-09 Thread Willoughby
In my case, I need to pull all the records (60,000) from the database to compute some aggregation which I cannot compute using sql Are you familiar with window functions in SQL? I've never met an aggregation need that couldn't be met with clever use of windows...

Re: [web2py] DAL speed - an idea

2012-02-09 Thread Anthony
I've been thinking about something like this as well. Instead of a separate select_raw() method, maybe we can just add a raw=True|False argument to the existing select() method. I like the namedtuple idea as well (I think some adapters already provide that as an option -- e.g., psycopg2).