Mind they are not equivalent.

s = storage(mw.ls == f).select(mw.iIdL).first()


fetches all records but filters the first at the python level. You want:

s = storage(mw.ls == f).select(mw.iIdL, limitby=(0,1)).first()


On Saturday, 6 April 2019 21:18:03 UTC-7, Metra Oknehcvark wrote:
>
> Hello , All!
>
> Hope someone can point me to right direction.
>
> I have restfull service , with a simple def like :
>
> ...
>
> u = storage.executesql('UPDATE mitms SET ls = "' + str(f) + '"  WHERE ls = 
> "N" LIMIT 1;')
>
> ...
>
> s = storage(mw.ls == f).select(mw.iIdL).first()
>
> ...
>
> return response.json({....})
>
> u and s query run as expected: like for 0.001-0.005s
>
> and everything is good when i make single queries from app.
>
>
> but when i run concurrent queries (like few hundreds++ threads), while 
> 3-5min , i get:
>
> u&s run same like 0.001-0.005.
>
>
> but full call from app take like 5 to 50seconds, app just query links to 
> download:
>
> request link xxx request_time 23.19139289855957
>
> request link xxx request_time 23.306612014770508
>
> request link xxx request_time 23.088869094848633
>
> request link xxx request_time 23.109781980514526
>
> request link xxx request_time 22.863523244857788
>
>
> In app i use requests py module ,simple get request. 
>
> Db and app local  for now.
>
> Thx in advance!
>

-- 
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