Skip to content

Conversation

@sekrett
Copy link

@sekrett sekrett commented Dec 18, 2022

Works much faster and fixes unknown error when database becomes large.

As I can see there is no option to change ordering, it is always on last_attempt field, only asc/desc may change. The index was already created, so just use it.

Works much faster and fixes unknown error when database becomes large.
@sekrett
Copy link
Author

sekrett commented Dec 18, 2022

I am sorry, it breaks the search. Error is:

rethinkdb.errors.ReqlQueryLogicError: Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters in:
r.db('maildata').table('sent_mail').filter(lambda var_4: var_4['mail_from'].match('@gmail.com$')).order_by(index=r.desc('last_attempt')).skip(0).limit(50)

I tried this. but now it is again slow as before:

    if empty(frm, itr=True):
        query = query.order_by(index=r_order)
    else:
        query = query.order_by(r_order)
    query = query.skip(offset).limit(limit)

I will try something else.

@sekrett
Copy link
Author

sekrett commented Dec 18, 2022

Fixed. Without search it uses index and it is very fast. When searching, it works like before.

@drlight17
Copy link

Fixed. Without search it uses index and it is very fast. When searching, it works like before.

Check my fork.. Work is still in progress however.

@sekrett
Copy link
Author

sekrett commented Jul 19, 2023

Wow, you did so many other improvements. Do you need this change for your fork also?

@drlight17
Copy link

Wow, you did so many other improvements. Do you need this change for your fork also?

If this will make queries faster you could make a PR and I will test it. ;) Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants