Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Nikhil.

Asked: November 07, 2016 - 11:32 am UTC

Last updated: November 08, 2016 - 6:37 am UTC

Version: 11.2.0

Viewed 1000+ times

You Asked

Hi Team,

I have requirement -
Consider : 1. Table1 is holding data current 5 years of data in primary database
2. Table1 is holding data older 5 years of data in other database(archived)

is there any way we can manage records retrieval like - if request comes in for 10 years of data, queries can written so that we can get data from table1 (from both databases).

Thanks!!


and Connor said...

You could create views to manage this, for example:

create view CONSOLIDATED_DATA as
select * from current_data
where date_col >= date '2010-01-01'
union all
select * from archived_data@remote_database
where date_col < date '2010-01-01'

but whenever you are querying multiple databases, you want to do lots of careful testing to ensure performance level are adequate. Simple queries are fine, but think about what happens when someone uses (say) the view above, in a 10-table join.

A more typical situation is that the data is in a single database, but in separate partitions/tables/tablespaces. You might to consider this.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, November 08, 2016 - 6:42 am UTC