miserable performance of union as view
Posted in 1999
I'm now using informix 7.30 UC5 on AIX. I was waiting for the feature
union in a view for quite a long time! And then this bad awakening!
Assume you have a table DATA with about 10.000 records, heavily
referenced by another table BIG with 200.000 - 500.000 rows. Sometimes
it is necessary to reorganize the DATA table, which means deleting all
duplicates of rows which are logical equal items (but holding different
data). DATA is maintained by users, but filled with rows via
data-transmission too - so we can't avoid logical duplicates in advance.
Well, when reorganizing DATA it is not possible to update BIG. So we sat
up a table LINK which hold the real_key and the pseudo_key. To resolve
any key, wether real or not I create a view DATA_VIEW as:
select * from DATA
union allselect LINK.pseudo_key key,.... from DATA,LINK where DATA.key =
LINK.real_key
selecting via the view (select * from data_view where key=123) is awful
slow - althogh the statement (select * from data union ...) itself is
pretty fast!!
Why? Can I do anything to improve performance?
I added the 'union all' to tell the database-server there is no need to
check for duplicate rows!
Thank you very much for your help
Peter Weigert