In various SQL implementations, a hint is a description added to the SQL standard that instructs and forces a database engine to execute a query in a specific way that is specified by a user even if there is a better way to execute the query. For example a hint may tell the engine which indexes are used or whether to use an index at all. Implementation: Different database engines such as MySQL or Oracle have implemented hints using different ways.
Questions tagged [query-hints]
70 questions
2
votes
1 answer
Oracle database hints for bulk Insert from DBLink
I need to insert around 50 tables that have bulk data in them via DBLink. I generally use the statement
insert into
select * from @DBLink
In some cases, it takes too long to insert. What useful database hints can be used…

Imran Hemani
- 599
- 3
- 12
- 27
2
votes
2 answers
Determine if an Index has been used as a hint
In SQL Server, there is the option to use query hints.
eg
SELECT c.ContactID
FROM Person.Contact c
WITH (INDEX(AK_Contact_rowguid))
I am in the process of getting rid of unused indexes and was wondering how I could go about determining if an index…

Joe Bloggs
- 105
- 1
- 6
2
votes
1 answer
Using @FetchGroup with eclipseLink
I have tried to get source running as explained in http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_fetchgroup.htm
@FetchGroup(name="names",
attributes={
@FetchAttribute(name="firstName"),
…

user3329359
- 21
- 2
2
votes
1 answer
Does with(updlock) reduce deadlocks in select queries?
We have tables that are written to and read from simultaneously in our SQL Server 2008 DB (normal isolation levels).
One colleague was wondering if the query hint with(updlock) on the select queries against that table would reduce deadlocks, but I…

ManOnAMission
- 1,023
- 1
- 12
- 31
2
votes
1 answer
Using Rowlock when inserting data helps..?
I want to use ROWLOCK option in sql server when inserting data into table. Does it helps in any manner. Will it help me to decrease blocking in my database?

Ashish
- 359
- 1
- 6
- 13
1
vote
1 answer
Can I modify the sql generated by Entity Framework before it's executed?
I have a multi-tenant database that returns vastly different numbers of rows depending on which tenant is being queried. Lately we are experiencing a parameter sniffing problem where Entity Framework (EF) queries executed against one tenant…

Mike
- 7,500
- 8
- 44
- 62
1
vote
2 answers
Use table hints with variable table
I have this variable table
declare @mapping table (
the_row int
, Company smallint
, Branch smallint
, Flag bit
index aa clustered (Company, Branch)
, index bb nonclustered (Flag)
)
It seems that I cannot use table hints…

clickit
- 21
- 3
1
vote
0 answers
Is it possible to set a Hibernate Query Hint by default in a Spring Boot application?
I must use the Hibernate Query Hint HINT_PASS_DISTINCT_THROUGH in every requests that uses DISTINCT keyword in my Spring Boot application.
Instead of setting the hint with the @QueryHint annotation or the Query.setHint method, I'm wondering if…

Guillaume Delafosse
- 222
- 1
- 3
- 14
1
vote
0 answers
"hints" formatted query output using oracle jdbc driver
Is it possible to get "hints" formatted query output using oracle jdbc driver?
example query
Select /*insert*/ * from sample_table
or
Select /*html*/ * from sample_table
looks like the stmt.executeQuer is just ignoring formatting "hints" and only…

David Abragimov
- 524
- 2
- 6
- 24
1
vote
1 answer
Spark-SQL Query Hints for Join Performance Improvement
I have recently been introduced to SparkSQL. We use Spark 2.4. I recently found out that SparkSQL query supports the following hints for its Join strategies:
BROADCAST hint
MERGE hint
SHUFFLE_HASH hint
Unfortunately, I have not found any online…

Matthew
- 315
- 3
- 5
- 16
1
vote
1 answer
Using 'HINTS' in sql query
i am sorry if i sound silly asking but i haven't been using sql hints long and i am going over some chapter review work for school. I am having trouble getting my head wrapped around them.
For instance, one question i did in oracle on a test…

Miwa
- 11
- 1
1
vote
1 answer
Query Performance on case expression
I have a table (Not all columns shown) that shows type.
Typeid is the PK. There is some date overlap that should not be there. I want to remove those from my query.
Custid typeid start_dt end_dt
101 352 3/28/2017 …

Mr John
- 231
- 1
- 3
- 18
1
vote
0 answers
How can i add a QueryHint to a Hibernate Custom Query?
I'm trying to add the Oracle Query Hint /*+ GATHER_PLAN_STATISTICS PARALLEL(16) */ to my Custom Query which looks similar to this:
@Query("SELECT " +
" FROM myTable tab " +
" WHERE tab.create_date >= to_date(:dateFrom) " +
" AND…

EyedPeas
- 146
- 4
- 17
1
vote
1 answer
Fetch jpa sql execution plan with @QueryHint and spring data repository
I am using spring-data for DB interaction. I want to see the jpa sql execution plan for a query written in repository. How can i do it.
https://vladmihalcea.com/execution-plan-oracle-hibernate-query-hints/ tells about using GATHER_PLAN_STATISTICS…

SATVIK
- 11
- 1
- 4
1
vote
1 answer
SQL Server 2008: Join VIEW with other VIEW: precalculate without resorting to temp tables
To perform transformations in my database, I frequently use a chained set of views. Within the views will be common table expressions. For example I would have the following:
CREATE VIEW TransformationStep1 AS
WITH Transformation1A AS (
…

littlegreen
- 7,290
- 9
- 45
- 51