question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce (Oracle) optimizer hints (on select )

See original GitHub issue

Oracle allows adding optimizer hint comments on selects that influence the execution plan of the query. With linq2db we can only add queryhints that get appended to the query but don’t help in case of an Oracle DB. I’d like to propose a feature that would look like this.

var result = db.TableName
   .Where(foo => foo.bar = "baz")
   .SelectWithHint("/* +NO_INDEX(TableName_bar) */", foo => foo.bar ).ToList();

this would create SQL like that:

SELECT /* +NO_INDEX(TableName_bar) */ bar  FROM foo WHERE bar = "baz";

Right now i don’t see that this is possible. In case of an convoluted legacy DB this Oracle feature is essential. Here are some more infos to Oracle query hints: https://docs.oracle.com/cd/B12037_01/server.101/b10752/hintsref.htm

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
MaceWinducommented, Jul 2, 2019

Yes, this is definitely one of features we want to implement. It will need some research to gather information about hints in all databases we support, to design and implement proper API, so it will take some time. I will add it to 3.0 roadmap

1reaction
sdanylivcommented, May 22, 2020

Try to override ExecuteReader and ExecuteReaderAsync in DataConnection and correct CommandText.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Optimizer Hints
Hints provide a mechanism to direct the optimizer to choose a certain ... DELETE , INSERT , SELECT , and UPDATE are keywords...
Read more >
19 Using Optimizer Hints
Hints enable you to make decisions normally made by the optimizer, sometimes causing the optimizer to select a plan that it sees as...
Read more >
7 Using Optimizer Hints
Table hints (i.e., hints that specify a table) normally refer to tables in the DELETE , SELECT , or UPDATE statement in which...
Read more >
8.9.3 Optimizer Hints
Another way to control the optimizer is by using optimizer hints, which can be specified within individual statements. Because optimizer hints apply on...
Read more >
Influencing the Optimizer with Initialization Parameters
Optimizer hints are special comments in a SQL statement that pass instructions to the optimizer. The optimizer uses hints to choose an execution...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found