It was not a perfomance tip, just a way to get her id...

:)

Richard


On Mon, Nov 4, 2013 at 3:39 PM, Niphlod <[email protected]> wrote:

>
>
> On Monday, November 4, 2013 8:39:41 PM UTC+1, Richard wrote:
>>
>> Ha ok, so you should try to see if it actually improve performance.
>>
>> To get the id you can do that :
>>
>> db().select(db.ref_assay.id).last().id
>>
>
> worst performance-related tip ever. That one selects the entire table,
> fetches it back and discards all records but the last.
>
> db.table.insert(whatever='something')
>
> is the best performance-wise, and the only method to retrieve efficiently
> the last inserted id.
>
> db.table[0] = dict(whatever='something')
> does the exact same thing (sql-wise) .... how can it return the last
> inserted id is kinda a non-question: given that you can't do any assignment
> to any variable, where should you put the hypothetical returned id ?
>
> --
> 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/groups/opt_out.
>

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

Reply via email to