• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2275
  • Last Modified:

Forcing Informix to use index

Is it possible to force a SQL statement to use a particular index in Informix Database?

We have a scenario like this:
There are two indexes on a table. Informix optimizer by default selects one index while executing that query. Is it possible to make Informix use the other index on the table for that query ? If yes, how ?

I have Informix 7.30 on HP-UX.
0
Tikshya
Asked:
Tikshya
1 Solution
 
afpcosCommented:
You can go to Informix web site and look at tech notes volume 9, Issue 1, 1999.

New to Informix 3.0
Optimizer Directives

Example:
SELECT --+ ordered index(customer, zip_ix) avoid_index(orders," 101_4")
customer.lname, orders.order_num, items.total_price
FROM customer c, orders o, items i
WHERE c.customer_num = o.customer_num
AND o.order_num = i.order_num
AND stock_num = 6
AND man_code = "SMT"

This forces the database engine to use the zipcode index on the customer table and avoid using the index on the orders table.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now