Hi guy, I'm using web2py version 2.7.2 with ubuntu 12.04.

I made a simple db.py:

state = db.define_table('state',
    Field('name','string',label=T('State')))

city = db.define_table('city',
    Field('name','string',label=T('City')),
    Field('state_id','reference state',required=True,
          requires=IS_IN_DB(db,'state.id', lambda reg: '%(city)s -
%(state)s' % dict(city=reg.name,state=reg.country_id.name))))

When I make a query:

db(db.city.name.contains('rio')).select(db.city.name,db.city.id,
db.state.name,join=db.city.on(db.city.state_id == db.state.id))

it takes 180ms, but when i make

db(db.city.name.contains('rio') & db.city.state_id == db.state.id).select(
db.city.name,db.city.id,db.state.name)

it takes 24 seconds waiting and 5 seconds to retrieve.

Looking inside, I saw that web2py is making a WHERE clause instead of a
JOIN.

It's normal?

-- 
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/groups/opt_out.

Reply via email to