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

feat(opinion): Add ordering key #4496

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat(opinion): Add ordering key #4496

wants to merge 3 commits into from

Conversation

flooie
Copy link
Contributor

@flooie flooie commented Sep 25, 2024

Add ordering key to Opinion class meta field for sub opinions

Postgres requires ordering for distinct columns
and since ordering_key is one we need to sort by
cluster and ordering key before we can distinct
@flooie flooie requested review from ERosendo and mlissner and removed request for ERosendo September 26, 2024 17:35
@@ -3472,6 +3472,7 @@ class Meta:
name="unique_opinion_ordering_key",
)
]
ordering = ["ordering_key"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I'd approach this this way. The problem with doing this is that it would apply the ordering everywhere, which imposes a performance penalty to queries where we don't care about the ordering. I think this is one of those django features that are considered an anti-pattern these days.

Can you refactor to apply the ordering only where we need and want it?

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