Skip to content

Support for index hints #871

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

Open
zebrapurring opened this issue Mar 30, 2025 · 3 comments
Open

Support for index hints #871

zebrapurring opened this issue Mar 30, 2025 · 3 comments

Comments

@zebrapurring
Copy link

Motivation

Some queries require manually disabling or specifying indexes, which is currently supported with index hints after the table name in the FROM clause.

See documentation of the support for index hints:

For PostgreSQL I haven't found an equivalent alternative.

Proposed Solutions

I would like to either:

  1. Implement support for SQLite and MySQL hints (platform specific)
  2. Implement a generic way to pass table hints to the tables used in the FROM clause
@Expurple
Copy link
Contributor

Generic support for custom FROM clauses would be useful and consistent with other escape hatches like Expr::cust.

It's a bit weird that methods like SelectStatement::from accept an IntoTableRef parameter, where TableRef is a rigid exhaustive enum that doesn't provide any escape hatches. Because of this rigidity, it looks like we'll need a major version bump to introduce an escape hatch.

If a maintainer reads this thread, please create a milestone for sea_query 0.33 and add this issue to that milestone.

@Expurple
Copy link
Contributor

Hmm, I've just noticed that MySQL index hints are already implemented. It's right there in the search

@zebrapurring
Copy link
Author

Right, I'm working with SQLite so I didn't notice the MySQL hints are already supported. Then maybe would make sense to implement the specialized hints for SQLite as well?

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

No branches or pull requests

2 participants