Subject [firebird-support] Re: Or vs Index
Author Svein Erling Tysvaer
At 09:07 17.07.2003 +0000, you wrote:
>I think I can use that to solve one of my past problem which until
>now haven't solve yet. I have a view which is very slow at first,
>what I did is to index all the field which where use in joining the
>table. Actually there are 4 tables in all in that view. But nothing
>Can you give me an example how to we apply that or?

Well, I always start with the plan the optimizer suggests, and look for use
of NATURAL or more than one index for all tables except the first. This
isn't neccessarily wrong, but if one of the indexes is far more selective
than the other I then modify the select to avoid the non-selective index
being used. Take the example I used in my previous answer, I would do


Since Firebird has no index on any of the constants 2 or 0, it cannot use
an index to find the hospital, I get the result I want and other users of
the database do not shout at me for making the database unavailable ;.)

For more specific help, you have to supply your query, plan and index
selectivity. Though I hope this gets you on the right track. Note that I
very rarely use outer joins (so I don't know how applicable such advice is
for such joins) and that these in general are slower than inner joins.


- I support Firebird, I am a FirebirdSQL Foundation member.
- Join today at