On an SAP Sybase ASE 15.5 database.
UNION works very slow
select col1,col2,col3
from table1(INDEX nn MRU),table2 (INDEX hh MRU)
where key1=key2
UNION
select col1,col2,col3
from table3(INDEX pp MRU),table2 (INDEX ll MRU)
where key4=key3
table 1 and 3 are small(10 records each tables 1 and 4 - are very large (68 mln records each) and I neeed only active records, which we have 1,5 mln in each big table,
Actually, I tried separate queries. The same slow. Even if I purge inactive records or select active record to different table, it still takes long time. Yesterday I rebuild one index in table1, but it doesn't help.
The problem is that I cannot delete inactive records by the company rule