I wrote this small patch to allow such thing with a simple:

  $query->selectKeyword('STRAIGHT_JOIN');

So that the final query looks like:

SELECT STRAIGHT_JOIN foo.a (...)

Comments

regilero’s picture

regilero’s picture

Status: Active » Needs review
regilero’s picture

Oups, there was a mistake on that patch.

nagba’s picture

Status: Needs review » Needs work

1) coding style issues
1a) i see two lines with trailing whitespaces, kill them please
1b) when there are items separated with comma there needs to be a space after the comma
1c) foreach is not a function, there needs to be a space between the keyword and the opening parenthese
1d) '} else {' should be 2 lines
1e) Doxygen sentences should end with a period.
2) correct me if im wrong but the examples you've brought are mostly specific to MySQL, in which case it might make more sense to reimplement the given function for MySQL instead adding this for every DB
3) if we'd allow STRAIGHT_JOIN then it would make sense to allow that for individual JOINs as well, not just as a SELECT directive

nagba’s picture

Status: Needs work » Needs review
StatusFileSize
new6.35 KB

how about this version ?

regilero’s picture

@nagba: feel free to fix formatting problems. Now effectivily theses optimisations keywords are MySQL only. A better solution is maybe a general method, dropping the keywords. Then the MySQL engine would still use them and for MySQL. An even better solution would list supported keywords for each database adapter.

pwolanin’s picture

Do we need to get this in 8.x as bug fix or feature first?

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.