CQRS materialized view - microservices

We need to implement CQRS in our microservice architecture(SAGA). I have the following doubts regarding the materialized view in the read database.
Is CQRS materialized view refers to the actual tables?
Suppose we have different formats of reports from the same tables, do we need to keep multiple views?
In the future, if we need a schema/format change, how do we incorporate that change into view?
a) if rebuilding the view is possible, does it take time and resources?
b) if so, arethere any alternatives
I have gone through many examples. But didn't get a clear picture about materialized view.
Appreciate your answers.

Related

Do Clickhouse materialized views support population from multiple materialized views?

Say I have final materialized view which indends to gather data from multiple other materialized views which in hand are updated from their tables by random period of time. So the final data is inconsistent constantly but is intended to be a ReplacingMergeTree which looks like not to cause major problems.
Is this architecture valid or is there a better approach? Thanks.

Disadvantages of Materialized View

I have been use Materialized View in Oracle11g.By Using this View, Can growth to Database size?Please let me know,disadvantages of MV.
A materialised view is best thought of as three basic components:
**
A query that defines a result set
A table to store the result of the query in, and whatever supporting indexes you add to it.
Metadata that controls the way in which the result set is refreshed, whether the result set can be used for query rewrite or
not, the state of the metadata, etc..
**
So, evidently the table and indexes are indeed going to use space.
I'm afraid that you really need to go and read the documentation for your version to understand these basic concepts, as the answer to your question is derived from basic of knowledge of what a materialised view actually is.
Materialized views are tables created(/updated) by a select at a specific time. So yes, they take some space in DB.
Learn all about Materialized view : http://docs.oracle.com/cd/B10501_01/server.920/a96567/repmview.htm

which is better to use a view or a materialised view?

So I have a process to design where there are few base tables on which I have to create a view and from that view I will extract and derive data and insert into an another table.
we would use this last table for extracting reports
This process will run daily, since the data on the base tables have updates have everyday.
he whole purpose of this process is to make things "faster" for reporting,
So my concern here is with using the view. I am wondering if a materialized view would be better to use here in terms of performance instead the view or view itself would be the better.
Has anyone had to deal with such situation and found an approach that performs well and works efficiently??
Any leads on this would be highly appreciated

Materialised View to be created on a view

I am new to oracle and i wanted to know if materialized views can be created on top of views. I also need a column in the mview that has a complex calculation for which I am thinking of writing a function.
There are materialised views, and then again there are materialised views.
By which I mean that the capabilities of the materialised view can vary greatly with respect to query rewrite and refreshability according to the exact nature of the tables (or views) that it references, and according to their properties.
So although you might be able to create an MV that references a view, whether it is useful to you or not is a matter that depends on a great many other issues.
I find that the documentation can sometimes be unclear, particularly in edge-cases, and the best approach is generally to create the MV and then to test its capabilities using Oracle built-in procedures -- here's a link to DBMS_MView for 10.2 http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_mview.htm#CEGGEHHC

Oracle View limitations

I am converting sybase stored procedures into oracle views. This is what they want and this is not my first choice. My question is:
Are there any limitations in oracle views? Total number of columns? Can you create indexes for views? Since I will be creating subviews and joining views within views, are there any limitations on how many layers of views you can do?
Thanks
Are there any limitations in oracle views?
Total number of columns?
are there any limitations on how many layers of views you can do
All covered here: http://docs.oracle.com/database/121/REFRN/GUID-685230CF-63F5-4C5A-B8B0-037C566BDA76.htm#REFRN0043
The number of columns in a view has the same limits as the number of columns in a table.
Can you create indexes for views?
No you cannot. However you cate create a materialized view, that can be indexed
You're limited to 1000 columns in a table. It wouldn't shock me if there was a similar limit for views. But if you're creating a view with 1000 columns, you're probably doing something very wrong.
You cannot create indexes on views but you can create indexes on the underlying tables that queries against views can use. You can index materialized views since, as the name implies, they materialize the data into a separate structure. But then you have to deal with refreshing the materialized view on commit, which adds overhead to transactions, or tolerate stale data and refresh the materialized view on some schedule.
There is no limit to the number of layers of views you can have. Depending on the Oracle version, the complexity of the views, and things like the presence of constraints, you can end up with queries that either force Oracle to do extra work (i.e. joining in additional tables in view layers that your end query doesn't actually need) or that are too complex for the optimizer to find a decent plan.
There aren't any significant limitations on the complexity of views.
The Oracle cost-based optimizer does a decent (if inscrutable) job of figuring out how to carry out queries to views using the indexes of the underlying tables.
If that performance isn't enough, you might consider looking into materialized views.
The usual way of doing the kind of project you're doing is to get the views working, then use EXPLAIN PLAN to do the optimization.

Resources