Re: Query using Union: performance
Posted in 1996
Carlos Seoane wrote: > > Hi, > I want to retrieve information from two identical tables, one is > current info and the other one has historical information. I am doing > a query of both tables using a UNION, with two identical SELECT, but > refering each one to a different table. > My question is: what about the performance?. Is there a better way to > do this? > Thank you. You might consider including your current info in your historical table, in addition to having a current table. I assume you use the current table to improve query time on current information. You could set up a trigger in your current table so that whenever a row is inserted/updated/deleted, the historical table is also affected. In this scenario, the current information becomes historical-only by simply dropping and recreating the current table (no mass migration of rows from one table to another). You can query current information in the current table as before. You can query current+historical information in the historical table. For historical-only information, you can use a "not in current" clause. Obviously, writing to the current table will slow down, which might not be acceptable in your case. Hope this helps, ---------------------------------------------------------------------- John H. Frantz Power-4gl: Extending Informix-4gl frantz@centrum.is http://www.strengur.is/~frantz/pow4gl.html