Am using sqlite.storage
On Sun, 2 Sep 2018, 21:03 justice Nanhou <[email protected]> wrote:
> Hallo Maurice,
>
> it is know issue for all application and all framworks.
> which database are you using ?
> - my first attempt will be to try to add indexes in the post and answers
> Table on the field author.
> - secondly i will try to change this row
>
>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>> message, orderby=~db.post.id, limitby=(0,1)).first()
>
> to this
>>
>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>> message, orderby=~db.post.id).first()
>
>
> limitby ist not needed in that case. it is just my opinion.
>
>
>
>
>
> Am Mittwoch, 29. August 2018 13:35:56 UTC+2 schrieb Maurice Waka:
>>
>> I noticed that my form submit takes too long, almost 45 seconds
>> sometimes. The more data I add to the database and I need to fetch it, the
>> more longer it takes to submit.
>> This is my code
>>
>> <div class="bottom_wrapper clearfix">
>> <div class="message_input_wrapper">
>> {{=form.custom.begin}}
>> <textarea id="message_input" type="text"name=
>> "message" placeholder="Type your message here..."></textarea>
>> <button>send</button>
>> {{=form.custom.end}}
>> </div>
>> <div class="message_template">
>> <li class="message">
>> <div class="message-data-time" ></div>
>> <div class="text_wrapper">
>> <div class="text"></div>
>> </div>
>> </li>
>> </div>
>> </div>
>>
>> Controller function
>>
>> def c_function():
>> form = SQLFORM(db.post).process()
>> row = db(db.post.author== auth.user.id).select(db.post.id, db.post.
>> message, orderby=~db.post.id, limitby=(0,1)).first()
>> names = row.message if row else None
>> db.answers.insert(quest=names, message=report())
>> replies = db(db.answers.author == auth.user.id).select(db.answers.ALL
>> )[-10:-1]
>> return dict(form=form,names=names,replies=replies)
>>
>> --
> 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.
>
--
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.