Defined like a view but holding persistent data like a table, Materialized Views are a feature of a number of RDBMSs including Oracle, DB2 and postgres. SQL Server has a similar feature called an Indexed View that is considered similar enough to come under this tag.

learn more… | top users | synonyms (1)

1
vote
0answers
52 views

Query with join to a table on a different database need an index

I'm creating a query that one of its joins is made to a table from a different database. The query analyzer is suggesting the creation of an index, however I don't have permission to add objects to ...
1
vote
0answers
25 views

Update column type when materialized views depend on the column?

I'm working in Postgres 9.4. I want to alter the type of a column in a table: ALTER TABLE mytable ALTER COLUMN quantity TYPE integer; But I get this: ERROR: cannot alter type of a column used by ...
1
vote
0answers
18 views

Need ODBC connection to postgresql to include materialized views

I have an Access front end user interface that links to tables in a postgreSQL database using the most recent ODBC driver. I can link to the postgreSQL tables and views but can't get to the ...
2
votes
0answers
16 views

Promote Postgres standby while materialized view updates in primary

I have one primary Postgres server (serverA) and one standby Postgres server (serverB), both running Postgres 9.4 with Streaming Replication enabled. Is it possible to update a materialized view on ...
11
votes
2answers
313 views

Indexed view in SQL Server

I have a table and an indexed view on it like Create table mytable1 (ID int identity(1,1), Name nvarchar(100)) Create table mytable2 (ID int identity(1,1), Name nvarchar(100)) Create view myview ...
6
votes
1answer
31 views

Update an Indexed View “Online”

Say I have an indexed view that looks like this: ALTER VIEW dbo.MyIndexedView WITH SCHEMABINDING AS SELECT ord.SomeColumn, COUNT_BIG(*) AS Count FROM dbo.Ordered ord WHERE ...
0
votes
0answers
13 views

How do transactions affect PostgreSQL's REFRESH MATERIALIZED VIEW CONCURRENTLY command?

PostgreSQL 9.4 supports REFRESH MATERIALIZED VIEW CONCURRENTLY. I'm not sure, but I think the REFRESH command is viewed as DDL by PostgreSQL, and PostgreSQL wraps all DDL within transactions so that ...
6
votes
1answer
39 views

Indexed (Materialized) View for Parent and Newest Child

Say I have parent->child tables setup. Call them Shipment and Widget. Is there anyway to create an Indexed view that will have the PK of the parent (ShipmentId) and the created when of the newest ...
0
votes
0answers
9 views

Do differing table schemas under a partitioning view preclude writability?

If I have two tables with slightly different schemas I can compose a partitioning view that includes all the columns that are identical between them. I was under the impression that as long as the ...
2
votes
1answer
73 views

Deterministic function for getting today's date

I am trying to create an indexed view using the following code (so that I can publish it to replication it as a table): CREATE VIEW lc.vw_dates WITH SCHEMABINDING AS SELECT DATEADD(day, ...
0
votes
0answers
15 views

How do you schedule the times that a material view can refresh in oracle 11.2g?

Currently we schedule MV refresh's hourly, but this is causing a problem due to conflicting timeslots with the overnight routines. Is it possible to either block refreshes between certain times of the ...
1
vote
1answer
48 views

Indexed Complex View

The aggregate functions MIN,MAX,AVG, and STDEV are not allowed in an Indexed View in SQL Server (Create Indexed Views - MSDN Library). Does SQL Server have a mechanism to index the results of the ...
0
votes
1answer
45 views

Postgres Refresh Materialized View Locks

I have a materialized view in Postgres, and want to know what locks (if any) are taken out when refreshing that view. CREATE TABLE people ( name VARCHAR(30) ); INSERT INTO people VALUES ('Alice'), ...
2
votes
0answers
24 views

Implications of many materialized views in Postgres?

I'm working on a system that includes a scheduling component, which has support for recurring events. After reading many, many posts on storing recurring events, it was suggested that they be ...
4
votes
0answers
66 views

transaction replication causing too many deadlocks after adding a indexed view - what to monitor in order to avoid this?

I have created the following indexed view and its clustered index: This view was created on a subscriber database and all the tables used in the view are constantly being written to through the ...
3
votes
1answer
126 views

what would be a good choice of clustered index (and other indexes) for this situation involving a indexed view?

To help me improve the performance of some queries I have created the following indexed view: CREATE VIEW DBO.vwOrders WITH SCHEMABINDING AS ...
8
votes
2answers
207 views

is there a work around for when you want to put an OR inside a filtered index?

is there a work around for when you want to put an OR inside a filtered index? create index FIDX_tblbOrders_sdtmOrdCreated_INCL on dbo.tblBOrder(sdtmOrdCreated) INCLUDE (sintMarketID, ...
0
votes
1answer
70 views

Unique clustered index on indexed view fails because of aggregates

I want to create an indexed view similar to this (slightly simplified): Create VIEW dbo._v1 WITH SCHEMABINDING AS SELECT COUNT_BIG(*) as CB ,[ID] ,TITLE] ...
0
votes
1answer
53 views

How do I copy a materialized view to a table?

I have a materialized view. I want to create a copy of it so I can modify some of the data to test a few theories about an issue and its possible solutions. How do I make a copy of this MV as a ...
10
votes
1answer
210 views

How to set up indexed view when SELECTing TOP 1 with ORDER BY from different tables

I am struggling to setup an indexed view in the following scenario so that the following query performs without two clustered index scans. Whenever I create an index view for this query and then use ...
0
votes
0answers
187 views

Materialized View does not reflect changes after fast refresh

I have a query with many aggregate functions working on almost a million records every time, it's taking up to (ten of) minutes to complete the query so I created a materialized view for it, and since ...
4
votes
1answer
54 views

How can I specify the DDL of the index that is implicitly created when creating a materialized view log?

When I create a materialized view log, Oracle implicitly creates an index on that log. For example, when creating a materialized view log on table foo, Oracle creates the view log table mlog$_foo and ...
1
vote
0answers
42 views

MQT automatic `set integrity off` when underlying table updated

Have a slow query. Need an MQT so the optimizer will rewrite the query and use my MQT instead. Problem: a manual full refresh is much much faster than using refresh immediate type or a staging table: ...
0
votes
0answers
84 views

How to check/know the highest run queries

I would like to gather statistics on the highest run queries in my database. For that I need to know how I can track queries so I can create views or materialized views to cache the results of the ...
0
votes
1answer
381 views

How to create scheduler for manually refresh Materialized View if the MV get need_compile stallness status

I've a problem to Automatically Refresh Materialized View, if the stallness condition is NEED_COMPILE / STALE / UNUSABLE OR NOT FRESH. I've MV with this PL/SQL : CREATE MATERIALIZED VIEW ...
4
votes
1answer
712 views

Query the definition of a materialized view in Postgres

I'm wondering how to query the definition of a materialized view in Postgres. For reference, what I hoped to do is very similar to what you can do for a regular view: SELECT * FROM ...
1
vote
1answer
220 views

List MATERIALIZED VIEWs in PostgreSQL that do not have a UNIQUE index

Postgresql 9.4 allows to REFRESH materialized views CONCURRENTLY, if they have a UNIQUE index. I am looking fo a SQL-query that lists all materialized views that DO NOT have such a UNIQUE or PRIMARY ...
0
votes
1answer
47 views

How to view the original script that built a materialized view and that was created by another user?

In the Oracle database server use, another user (called MIMIC2DEVEL) created a materialized view and made it public. How to view the original script that was used to built it? Here are the grants on ...
2
votes
0answers
49 views

Create Nested XML in a Sql Server Indexed (Materialized) View

This page https://msdn.microsoft.com/en-us/library/ms188276.aspx indicates that if you wanted nested XML (ie an XML Tree) then you need to setup your query like this: SELECT Col1, Col2, ...
2
votes
1answer
323 views

Postgres: check disk space taken by materialized view?

I know how to check the size of indexes and tables in Postgres (I'm using version 9.4): SELECT relname AS objectname, relkind AS objecttype, reltuples AS "#entries", ...
0
votes
0answers
35 views

Refresh materialized view in Teiid

I have created a teiid vdb with sql server data source. The view model contains a materialized view, how to refresh the materialized view manually or automatically? Is there any sql command to trigger ...
0
votes
1answer
312 views

Working with Materialized View

I have a materialized view which takes around 57 second to be created and I'm using PostgreSQL 9.4. When I do an insert into a table, a trigger will call a trigger function which will do a REFRESH ...
3
votes
1answer
501 views

Is it possible to backup and restore a materialized view with it's data?

I have some hard to compute materialized views, which I want to be able to backup and restore using the actual stored data, and not by recomputing. Is it possible in PostgreSQL 9.4? (the alternative ...
0
votes
0answers
27 views

Oracle Mview - Get DML Type

I'm trying to create a replication of a table on a remote server. Table on remote Server : tbl_remote. i created a MATERIALIZED VIEW LOG on tbl_remote. also in my local server i created a ...
0
votes
0answers
203 views

index of aggregate value with fast update?

Is it possible for me to index the sum of a particular table column, such that future lookups will not have to scan the entire table? This table will grow to be very large and a sum of the entire ...
4
votes
1answer
267 views

How to optimize: having COUNT(*)>1

Without considering the indexes, Is there a way to re-write this query and get the same result quicker? select fo.OrderNo, fo.OrderItemSeqNo, COUNT(*) from Facts.FactBackOrder fo group by fo.OrderNo, ...
2
votes
0answers
83 views

When will SQL Server automatically use a supporting indexed view?

I have the following expensive query that runs against our data warehouse: SELECT d.DateYear, COUNT_BIG(*) AS WidgetCount FROM Widgets AS w JOIN Dates AS d ON d.DateId = w.DateId WHERE ...
8
votes
2answers
908 views

Using indexed views for aggregates - too good to be true?

We have a data warehouse with a fairly large record count (10-20 million rows) and often run queries that count records between certain dates, or count records with certain flags, e.g. SELECT ...
5
votes
1answer
4k views

Best way to create materialized view in mysql

I am using mysql 5.6, I am not being able to create materialized view here like oracle. I got one or two solution like flexview and all... Can anybody tell me best way to create materialized view in ...
11
votes
2answers
4k views

Refresh materalized view incrementally in PostgreSQL

Is it possible to refresh a materialized view incrementally in PostgreSQL i.e. only for the data that is new or has changed? Consider this table & materialized view: CREATE TABLE graph ( ...
0
votes
1answer
526 views

Does MariaDB Support Materialized views?

Before i even try to experiment with MariaDB, could anyone tell me if MariaDB support Materialized views? i can't seem to find it in their documentation. This is one of my major issues with Mysql ...
2
votes
1answer
105 views

Indexed View - how to verify if it is worthy?

I have the following indexed view: CREATE view VProcessStatus WITH SCHEMABINDING AS select processstatus, StatusCount = COUNT_BIG(*) FROM DBO.tbltaxtransaction GROUP BY ...
0
votes
0answers
49 views

Is it possible to create materialized view based on another materialized view in postgres?

I have a very large table and I summarize it in a materialized view. I then create an even smaller materialized view based on the earlier mview. The second mv is always showing zero rows. Is there a ...
1
vote
1answer
684 views

postgres materialized views and indexes to improve aggregate performance

I have a large table with a number of materialized views used for pre-calculating aggregates. New data is inserted only once a day so think of this as a data warehouse type system. Obviously when I ...
2
votes
1answer
297 views

Does view take advantage of table indexes

I have a table with a clustered index and 2 non clustered index. Now, in my view I am selecting everything from my table create view dbo.MyView as Select * from MyTable Now, when I am using this ...
1
vote
0answers
55 views

reduce the cost of maintaining a materialized view? [closed]

how to reduce the cost of maintenance a materialized views? and when I selected between maintaining by recompiling and maintaining by refresh?
2
votes
0answers
61 views

Optimization suggestions for db2 materialized view

I have a view for db2 9.7 which has consolidated o/p from few tables. The view is built and it is working fine I want optimization suggestions on the view SQL CREATE VIEW XYZZ AS SELECT ...
0
votes
1answer
95 views

The materialized view is already optimal and cannot be tuned any further

I have tried DBMS_ADVISOR.TUNE_MVIEW to verify some materialized views created locally. One of the result returns an error: Error report: ORA-13600: error encountered in Advisor QSM-03116: The ...
5
votes
1answer
241 views

Why does dropping a MVIEW trigger a full refresh?

I just created a materialized view in Oracle but realized I used the wrong script, so I wanted to drop the MVIEW again. The MVIEW was created with a statement like this: create materialized view ...
3
votes
1answer
364 views

How to move 200 materialized views without having to re-create in the new home

I am moving a database with 200 materialized views into a new server. All of them are 'fast refresh' materialized views , means they have corresponding materialized view logs, in this case sitting on ...