-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Add new Rails/OrderById
cop
#323
Conversation
d110fa5
to
695ddc9
Compare
I'm a little wary of this because there are likely some legitimate uses of ordering by ID - it's just not appropriate when you need chronological ordering. |
Sure, there are, but i think, and as i saw in the past, almost always the author thought about chronological ordering when used constructions like this. |
I agree with @andyw8's opinion and it seems like query plan may change. I'm worried about proposing this by default because it seems a bit aggressive. |
695ddc9
to
d6d8952
Compare
Made it disabled by default and added a note about possible performance changes. |
Thanks! |
Sorry if I'm turning this into a discussion I was just going through the changelog and reading the concerns. I want to add context for the future if this comes up again and highlight introducing a subtle bug. Ordering by id is very common as databases do not guarantee records are returning in any particular order, in fact, the current good example of swapping So the use case for Timestamp columns themselves don't really offer any guarantees of truth either only as a matter of display. Since they are in rails commonly set by application servers not perfectly in sync, db calls arrive and execute at different speeds and |
This is an implementation of https://rails.rubystyle.guide/#order-by-id