It's backend's job to know if it's "better" to use the index or to proceed 
as normal. It's normally referred as "query optimizer stage".

In SOME backends you can issue rather specific sql "hints" to "optimize 
yourself" (if you think you're smarter than your backend) the query, but 
being that specific it's impossible to abstract those hints in a DAL 
helper. You'd have to read your backend documentation and write the query 
by hand.

BTW: I'm a DBA and I'm quite sure that less than 1 person on a thousand is 
smarter than a backend like postgresql, oracle or mssql, and that 
"smartness" is actually valid on a total of 1 query on 10k.

tl;dr : let the backend argue about using or not the index.

On Thursday, November 12, 2015 at 8:05:54 PM UTC+1, Fabiano Almeida wrote:
>
> Hi All!
>
> In book 
> <http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=indexes#Indexes>
>  
> I see example how to create index with executesql . How to use indexes in 
> querys?
>
> Thx,
>
> Fabiano.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to