Re: Choosing Indices
Posted in 1996
Topics: Performance & Tuning, SQL Development & Query Writing
this is a hack, and may not work on all versions of engines, but you can
try:
Select *
from table1
where x = '1'
and y = '11'
and y = '11'
and y = '11';
this has worked for me in the past to "trick" the optimizer into using a
specific index.
-joe-
(huddles@hasting.com)
----------
From: informix-list-owner
To: nnob
Cc: informix-list
Subject: Re: Choosing Indices
Date: Tuesday, January 30, 1996 4:27PM
On Tue, 30 Jan 1996, Nick Nobbe wrote:
} On Tue, 30 Jan 1996, Joseph Kormann wrote:
}
} > Is there a way to choose the main index that you want to search on?
} >
} > If I have a where clause with two statements. Both statements have their
} > own indices. Problem is I want the query to run the initial index off
the
} > second statment, then subquery to the first statement.
} >
} > I've tried reversing the statment order, but SQL still does it the same
} > way. Any help?
} >
} Joseph,
} No offense but can you show us what you're trying.
} Yours,
} Nick
}
Select *
from table1
where x = '1' and
y = '11';
There's separate indices on x and y. I want to find everything for y
first, then for x. If I do a 'Set Explain On', it shows that SQL first
looks up by x then by y. I want the main index to be y.
Any help?
-Joseph