Query Hints (Option Clause)

Posts   
 
    
Angus
User
Posts: 44
Joined: 08-Jul-2005
# Posted on: 22-Jul-2008 21:40:35   

Is there any way to use Query Hints with LLBLGen Pro?

For Example from BOL


USE AdventureWorks ;
GO
SELECT ProductID, OrderQty, SUM(LineTotal) AS Total
FROM Sales.SalesOrderDetail
WHERE UnitPrice < $5.00
GROUP BY ProductID, OrderQty
ORDER BY ProductID, OrderQty
OPTION (HASH GROUP, FAST 10) ; <--This is the query hint
GO

We have a DBA (Consultant) Examining our db and suggested some performance gains by using query hints.

Thanks.

-Chris

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 22-Jul-2008 22:48:03   

AFAIK, you can but is it really worth it.

One way would be to place the "optimized code" in stored procedures.

You would lose a lot of the benefits of LLBLGen, I'm thinking specifically of dynamic criteria clauses (WHERE).

The other would be create a derived DataAccessAdapter and override the ToQueryText method to modify the SQL before it gets sent to the database server.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jul-2008 06:54:34   

In v2.6, the mechanism was has been a bit so people who want to add hints per table, can do so by extending the framework. This isn't as easy as adding a method somewhere, the DQE has to be adjusted so a new dbspecific creator is created which handles the hint specification. In v2.5, it's not really doable for Oracle, the mechanism wasn't that extensible as it turned out (hence the change in v2.6).

(If you needs hints for making a query perform, the query might be better of in a view. )

David Elizondo | LLBLGen Support Team