Skip to content

Use index and increase array limit - #12

Open
sekrett wants to merge 2 commits into
Privex:masterfrom
sekrett:use-index
Open

Use index and increase array limit#12
sekrett wants to merge 2 commits into
Privex:masterfrom
sekrett:use-index

Conversation

@sekrett

@sekrett sekrett commented Dec 18, 2022

Copy link
Copy Markdown

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

sekrett commented Dec 18, 2022

Copy link
Copy Markdown
Author

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

sekrett commented Dec 18, 2022

Copy link
Copy Markdown
Author

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

@drlight17

Copy link
Copy Markdown

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

sekrett commented Jul 19, 2023

Copy link
Copy Markdown
Author

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

@drlight17

Copy link
Copy Markdown

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