Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Optimize query matching when chaining filters #25

Closed
agateblue opened this issue Feb 23, 2016 · 4 comments
Closed

Optimize query matching when chaining filters #25

agateblue opened this issue Feb 23, 2016 · 4 comments

Comments

@agateblue
Copy link
Owner

The current pattern when chaining filters do not merge queries together:

manager.filter(query1).exclude(query2)

When evaluating the queryset, it will loop over available values, return the one that match query1, then loop other these remaining values and exclude the one that match query2.

It would be more efficient to loop only once on all values, and return only values that match all queries.

@Mec-iS
Copy link
Contributor

Mec-iS commented Mar 11, 2016

You may find something interesting at Python Dee perhaps.

@agateblue
Copy link
Owner Author

Thanks for the link, I never heard about it but there are sure interesting ideas in there.

Regarding this specific issue, though, this is something I'm working on by compiling queries together, before running them against the dataset. You can see the feature/backend branch for more details.

@Mec-iS
Copy link
Contributor

Mec-iS commented Mar 11, 2016

Cool. I thought it could be something to be done using sets' intersection. I will follow along on the branch. Maybe add the reference link to the solution you are trying then.

@agateblue
Copy link
Owner Author

You're right, I've opened a regular PR to show the branch state, please refer to #34 for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants