Skip to content

added indexHint - #8401

Closed
felipefdl wants to merge 2 commits into
sequelize:masterfrom
tago-io:master
Closed

felipefdl wants to merge 2 commits into
sequelize:masterfrom
tago-io:master

Conversation

@felipefdl

@felipefdl felipefdl commented Sep 30, 2017 •

Copy link
Copy Markdown

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Adding new feature, indexHint, where we can select which index we wish use.

The documentation is from: https://dev.mysql.com/doc/refman/5.7/en/index-hints.html

Examples:

{
  where: { id: 'myid' },
  indexHint: [['USE', 'id']],
}
{
  where: { id: 'myid' },
  indexHint: [[['USE', 'id'], ['USE', 'created_at']]],
}
{
  where: { id: 'myid' },
  indexHint: [['FORCE', 'id']],
}
{
  where: { id: 'myid' },
  indexHint: [['IGNORE', 'id']],
}

@codecov

codecov Bot commented Sep 30, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #8401 into master will decrease coverage by 0.1%.
The diff coverage is 9.09%.

@eseliger

Copy link
Copy Markdown
Member

Please add some tests for this feature

@sushantdhiman

sushantdhiman commented Oct 1, 2017 •

Copy link
Copy Markdown
Contributor

I think we should not add this feature. Reasons

  1. I think only MySQL and MSSQL supports it.
  2. This feature is not demanded by many users and will complicate query generator.
  3. If you really want some query to be fine tuned for optimum performance I would recommend write that query yourself as per your database / indexes conditions. That will always beat ORM generated SQL which have to support many features and criterias.

@felipefdl

Copy link
Copy Markdown
Author

@sushantdhiman We have 19k of tables, almost 3 billions of records. The mysql system cannot choose right index for my queries, we have a lot combinations of index, dependents of the query is. So basically you saying the sequelize is not able to handle big data systems. So, I will keeping the for of sequelize with these modifications and I should keep updating the lib always when you guys release a new version, I cannot understand why sequelize doesn't support the parameters so useful for big data softwares.

@sushantdhiman

sushantdhiman commented May 9, 2018 •

Copy link
Copy Markdown
Contributor

In past I have rejected this feature because there was little to no demand, but it seems now this feature is desired by some users.

There are three PRs related to this change #9378, #9409 & #8401

I suggest authors of these PRs or anyone else who want this feature to suggest an API #9421 and propose a single PR after API is finalized.

Looks like MySQL / MSSQL / SQLite support this feature. PR with support and tests for all these dialects will be appreciated

@sushantdhiman sushantdhiman mentioned this pull request May 9, 2018
2 of 4 tasks
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.

3 participants