Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for partial index #396

Open
billy1624 opened this issue Jul 26, 2022 · 5 comments · May be fixed by #478
Open

Support for partial index #396

billy1624 opened this issue Jul 26, 2022 · 5 comments · May be fixed by #478
Assignees
Milestone

Comments

@billy1624
Copy link
Member

Discussed in SeaQL/sea-orm#872

Originally posted by @onichandame

Motivation

Sqlite supports a WHERE clause on creating an index. see docs

This feature is useful if only a subset of rows need to be indexed. Without it the index must cover all rows, which unnecessarily consumes more disk space.

Proposed Solutions

Something like sea_query::Index::create().filter(<Condition>) for use with entities, and sea_query::Index::create().filter_raw("<Where Clause>") for more freedom.

Additional Information

@billy1624
Copy link
Member Author

As far as I know, both SQLite and PostgreSQL supported partial index, docs:

But MySQL doesn't support it. I think we could introduce this feature in SeaQuery as 2 out of 3 databases support it.

@kyoto7250
Copy link
Contributor

@billy1624

I have an interest.

Could you leave it to me?

@kyoto7250
Copy link
Contributor

kyoto7250 commented Aug 2, 2022

@ikrivosheev

Thank you, I will try it!

@billy1624
Copy link
Member Author

Thanks! @kyoto7250

@kyoto7250 kyoto7250 mentioned this issue Aug 7, 2022
1 task
@kyoto7250
Copy link
Contributor

kyoto7250 commented Aug 7, 2022

@billy1624

I created WIP PR. #405
Would you review my implementation once?

I am not in a rush :)

@ikrivosheev ikrivosheev added this to the 0.27.x milestone Aug 9, 2022
@kyoto7250 kyoto7250 linked a pull request Oct 16, 2022 that will close this issue
3 tasks
@ikrivosheev ikrivosheev modified the milestones: 0.27.x, 0.28.x Oct 21, 2022
@ikrivosheev ikrivosheev modified the milestones: 0.28.x, 0.29.x Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging a pull request may close this issue.

3 participants