Introduce (Oracle) optimizer hints (on select )
See original GitHub issueOracle 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:
- Created 4 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
Try to override
ExecuteReader
andExecuteReaderAsync
in DataConnection and correctCommandText
.