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

[feature request] MySQL Optimizer Hints #1320

Open
mickeyreiss opened this issue Oct 23, 2023 · 4 comments
Open

[feature request] MySQL Optimizer Hints #1320

mickeyreiss opened this issue Oct 23, 2023 · 4 comments

Comments

@mickeyreiss
Copy link
Contributor

MySQL has support for Optimizer Hints, which implemented with comments that appear between SELECT and the column list.

For example:

SELECT /*+ MAX_EXECUTION_TIME(1000) */ * FROM users;

I would like to be able to insert optimizer hints with a query mod, maybe something like this:

models.Users(
	qm.OptimizerHint("MAX_EXECUTION_TIME(%d)", 1000),
).All(ctx)
@mickeyreiss
Copy link
Contributor Author

mickeyreiss commented Oct 24, 2023

Here is some WIP for adding this feature: 14739a8. It looks like it would be relatively simple to add—similar to #872.

@stephenafamo
Copy link
Collaborator

Can you create a PR for this? It would be much easier to review.

@mickeyreiss
Copy link
Contributor Author

Can you create a PR for this? It would be much easier to review.

@stephenafamo my solution isn't fully baked yet. For example, I haven't considered databases other than MySQL. I wanted to get feedback on the feature and approach before opening a pull request. If you see any issues as is, feel free to leave a comment on the commit.

@stephenafamo
Copy link
Collaborator

I haven't considered databases other than MySQL

Yes, this is an issue because SQLboiler uses the same query builder for all dialects.

Personally, I think it is fine. Because it is similar to qm.Returning which is not supported in MySQL but we have mods for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants