under 4.9.2, we are trying without much luck to fill in a form to have
the effect of something like QBE -- the user fills in as many fields
as they know, and a stored procedure is called which does an AND query
on all of those that have been supplied.
unfortunately, the tables involved are quite large, so we're trying to
avoid table scans.. all of the fields we're searching
on are indexed.
so we tried:
etc. for all the fields in the form
AND equijoins on key fields in table1, table2, table3, table4
takes FOREVER...
is forcing a table scan on table2... and the execution plan is entirely
different.
when we comment it out, everything works nicely.
unfortunately, upgrading to a later data server is not possible, and.
unrolling the query would result in 512 different queries.
we are slighly stumped.
any hints?