materialized-views

Materialized Views - Identifying the last refresh

前提是你 提交于 2019-12-04 07:53:32
问题 I presently access a series of views and materialized views. The materialized are maintained by a third party who offers little information regarding the frequency and success of the materialization. Of late the materialized views have failed to refresh and I have sent out numerous reports with incorrect/delayed data contained within. At present I am querying each materialized I intend to use to establish when the latest update occurred within the transactional system, if it has not been

Column data types for materialized views?

白昼怎懂夜的黑 提交于 2019-12-04 07:20:53
For general tables and views, I can see their data type by running the following query: select data_type from information_schema.columns where ..... However it does not seem that any information about materialized views appear here. I am able to get a list of columns for a materialized view by running: SELECT a.attname as column_name FROM pg_catalog.pg_attribute a INNER JOIN (SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname ~ ('^(materializedview)$') AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 2,

oracle materialized view refresh time

旧城冷巷雨未停 提交于 2019-12-04 06:59:29
anyone able to tell me how often a materialized view is set to refresh with the following setting plz? REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1 i think i read it as every hour but i'm not sure SQL> alter session set nls_date_format = 'yyyy-mm-dd :hh24:mi:ss'; Session changed. SQL> select sysdate from dual; SYSDATE -------------------- 2008-12-19 :12:18:28 SQL> select (round(sysdate) + 1/24) + 1 from dual; (ROUND(SYSDATE)+1/24 -------------------- 2008-12-21 :01:00:00 To answer your first question (will this run once an hour?): Nope, this will run once when

Oracle - Materialized View alter structure so slow

社会主义新天地 提交于 2019-12-04 03:59:04
问题 I have a huge materailized view that I have to adjust. It's a simple adjustment as I'm just adding an NVL function to the select statement. I.e. Original... Select this, that..... I.e. Modified Select NVL(this, orThat) as this, NVL(That, orThis) as that The query takes 26 seconds to run, but due to the amount of rows retrieved (2.3 million) it is dead slow. It ran for almost 5 days straight and then I stopped it. This is a problem, especially since I need to deliver this to a client, and they

Why does a ORA-12054 error occur when creating this simple materialized view example?

旧街凉风 提交于 2019-12-04 01:50:37
问题 ALTER TABLE RECORDINGS ADD PRIMARY KEY (ID); CREATE MATERIALIZED VIEW LOG ON RECORDINGS TABLESPACE USERS NOLOGGING; DROP MATERIALIZED VIEW REC_SEARCH_TEST; CREATE MATERIALIZED VIEW REC_SEARCH_TEST REFRESH COMPLETE ON COMMIT AS ( SELECT DISTINCT ID, TITLE FROM RECORDINGS ); ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view Cannot understand what is wrong here, I know that if I take out the DISTINCT clause it works, but why can I not use 'DISTINCT' if I specify

List grants and privileges for a materialized view in PostgreSQL

拟墨画扇 提交于 2019-12-04 01:02:57
I need to determine what privileges are currently granted for some materialized views in my database. The query to do this for a table or standard view is pretty straight forward: SELECT grantee, string_agg(privilege_type, ', ') AS privileges FROM information_schema.table_privileges WHERE table_schema = 'some_schema' AND table_name = 'some_table' GROUP by grantee; That said, there doesn't seem to be an analogous table for materialized views. Where does PostgreSQL store this information? In Postgres system catalogs are the basic set of complete information about the installation and databases.

Subquery's rand() column re-evaluated for every repeated selection in MySQL 5.7/8.0 vs MySQL 5.6

删除回忆录丶 提交于 2019-12-03 20:31:35
I am doing a subquery in which I have a calculated column involving random number generation. In the base query I select this column twice. MySQL 5.6 works as I expect, the calculated value being called once and fixed. The 5.7+/8.0+ execution seems to re-evaluate the subquery's column value individually for each selection. Is this correct behavior? What can I do to force it work as expected in newer versions of MySQL? CREATE TABLE t ( `id` BIGINT(20) NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE=InnoDB; insert into t values(); insert into t values(); insert into t values(); insert into t values

Update materialized view when urderlying tables change

流过昼夜 提交于 2019-12-03 07:32:17
问题 I have a materialized view defined this way: CREATE MATERIALIZED VIEW M_FOO REFRESH COMPLETE ON COMMIT AS SELECT FOO_ID, BAR FROM FOO WHERE BAR IS NOT NULL GROUP BY FOO_ID, BAR / COMMENT ON MATERIALIZED VIEW M_FOO IS 'Foo-Bar pairs'; I wrote as a sort of cache: the source table is huge but the number of different pairs is fairly small. I need those pairs to get them JOINed with other tables. So far so good: it absolutely speeds queries. But I want to make sure that the view does not contain

How to implement Materialized View with MySQL?

橙三吉。 提交于 2019-12-03 06:59:35
问题 How to implement Materialized Views? If not, how can I implement Materialized View with MySQL? Update: Would the following work? This doesn't occur in a transaction, is that a problem? DROP TABLE IF EXISTS `myDatabase`.`myMaterializedView`; CREATE TABLE `myDatabase`.`myMaterializedView` SELECT * from `myDatabase`.`myRegularView`; 回答1: I maintain a project called Flexviews (http://github.com/greenlion/swanhart-tools) which adds incrementally refreshable materialized views to MySQL (aka fast

Materialized View vs. Tables: What are the advantages?

橙三吉。 提交于 2019-12-03 04:30:32
问题 It's clear to me why a materialized view is preferable over just querying a base table. What is not so clear is the advantage over just creating another table with the same data as the MV. Is the only advantage to the MV really just the ease of creation/maintenance? Isn't an MV equivalent to a table with matching schema and an INSERT INTO using the MVs SELECT statement? Meaning, you can create an MV as follows CREATE MATERIALIZED VIEW ... AS SELECT * FROM FOO; And you can create an equivalent