Skip to content

Conversation

@DaemonSnake
Copy link
Contributor

select(1) with limit(1) is sufficient for databases to optimize away the order_by. In some cases removing the order_by clause will change the query-plan leading to seq-scans instead of index usage.

`select(1)` with `limit(1)` is sufficient for databases to optimize away the order_by.
In some cases removing the `order_by` clause will change the query-plan
leading to seq-scans instead of index usage.
@josevalim josevalim merged commit 016eefa into elixir-ecto:master Dec 29, 2025
7 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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