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 index ordering (ASC/DESC) #4150

Closed
natemcmaster opened this issue Dec 21, 2015 · 9 comments · Fixed by #27210 or #28489
Closed

Support for index ordering (ASC/DESC) #4150

natemcmaster opened this issue Dec 21, 2015 · 9 comments · Fixed by #27210 or #28489
Assignees
Labels
area-migrations area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-6.0 type-enhancement
Milestone

Comments

@natemcmaster
Copy link
Contributor

natemcmaster commented Dec 21, 2015

After discussion on #11846, we decided that the way to handle this is to allow multiple named indexes to be created over columns, while still preserving the current semantics (i.e. addressing by ordered property set) for unnamed indexes.

Original issue:
Add support for column sort order to migrations, metadata, and reverse engineering.

  • Add API to specific ascending/descending columns in an index (
    CREATE INDEX IX_1 ON Table ( Col1 DESC, Col2 ASC) )
  • Add to reverse engineering database model (prototype here)
  • Adapt to older version of SQLite (sort order is not supported < 3.8.9)
@jjxtra
Copy link

jjxtra commented Mar 5, 2018

Is this going to happen anytime soon? Using EfCore.Shaman to workaround this issue and others at the moment...

@ajcvickers
Copy link
Member

@jjxtra This issue is in the Backlog milestone. This means that it is not going to happen for the 2.1 release. We will re-assess the backlog following the 2.1 release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

@ajcvickers ajcvickers changed the title Support column sort order in indexes Support indexes with DESC order by allowing named indexes Jun 4, 2018
@roji
Copy link
Member

roji commented Feb 18, 2019

Note that this is being done in Npgsql as part of npgsql/efcore.pg#705. It would ideally be better to have implemented here as well so that Npgsql can align (and reuse the same SortOrder enum, possibly).

@bhugot
Copy link

bhugot commented Dec 10, 2019

Hello any news ont this feature

@ajcvickers
Copy link
Member

@bhugot This issue is in the Backlog milestone. This means that it is not currently planned for any upcoming release. We will re-assess the backlog for 5.0 and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

@roji roji changed the title Support indexes with DESC order by allowing named indexes Support multiple indexes over same column(s) with differing ASC/DESC or collation Apr 16, 2020
@roji
Copy link
Member

roji commented Apr 16, 2020

Another variant of this issue is for having multiple indexes on the same column, but with different collations (supported by PostgreSQL and Sqlite, but not SQL Server and MySQL).

@lajones lajones removed this from the Backlog milestone May 28, 2020
@lajones
Copy link
Contributor

lajones commented May 28, 2020

Clearing Milestone to reconsider this, or part of this, for 5.0 per this comment.

@clement911
Copy link
Contributor

I hope this makes it for the next release.

Our entity has a primary key TenantId bigint, IsPriority bit
Ideally, we want to be able specify DESC on the IsPriority, so that values of 1 are naturally ordered before values of 0 when we select the rows of a given tenant.

As a work around, we have had to changed the name of the property to IsNotPriority, so that the priority rows have a 0 and are ordered first in the index. It's a shame to have to improperly name things because of limitations of EF.

@roji
Copy link
Member

roji commented Jan 18, 2022

Splitting collation support out to #27209

@roji roji changed the title Add support for index ordering - ASC/DESC and collation Add support for index ordering (ASC/DESC) Jan 18, 2022
roji added a commit to roji/efcore that referenced this issue Jan 19, 2022
@roji roji added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. and removed consider-for-current-release labels Jan 19, 2022
roji added a commit to roji/efcore that referenced this issue Jan 19, 2022
roji added a commit to roji/efcore that referenced this issue Jan 19, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, 7.0.0-preview1 Feb 14, 2022
@ajcvickers ajcvickers changed the title Add support for index ordering (ASC/DESC) Support for index ordering (ASC/DESC) Feb 28, 2022
@roji roji linked a pull request Jul 21, 2022 that will close this issue
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview1, 7.0.0 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migrations area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. punted-for-6.0 type-enhancement
Projects
None yet
10 participants