Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijINQ-0001VE-5t for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Dec 2019 07:43:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ijINO-0008De-Mr for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Dec 2019 07:43:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ijINO-0008CS-5o for pgsql-hackers@lists.postgresql.org; Mon, 23 Dec 2019 07:43:38 +0000 Received: from esa11.fujitsucc.c3s2.iphmx.com ([216.71.156.121]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ijINJ-0006yA-SS for pgsql-hackers@postgresql.org; Mon, 23 Dec 2019 07:43:36 +0000 IronPort-SDR: 9Z3456/vCLp0TUP6xLQLuNvKNMWZrfh5lNI9NljeXZJ8DmdlRpR0g8YANyWQ5HcDaISv9Il/2n YuDAhNylZaRkfSFmP6rqCTZTtQH7qxiSukxvWBsUjTkLIfavNjtyta/TXtg8B6VvoxqwLnOTX/ NSjKjgIGIpBHbj2/JOMg0kbPT9q0QFFPq7ZjSXoiRJC2spJLj1G1XBdfGOt9Njx7bTAc8dFjUF Yt5pKET5FJ3t7sntQj5RrqJ5Jkenxk+FSOYGLeja5+TngVt+u5k99AbBbCfzGDqspxlRq4RbmQ esM= X-IronPort-AV: E=McAfee;i="6000,8403,9479"; a="8885546" X-IronPort-AV: E=Sophos;i="5.69,346,1571670000"; d="scan'208";a="8885546" Received: from mail-ty1jpn01lp2053.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([104.47.93.53]) by ob1.fujitsucc.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Dec 2019 16:43:26 +0900 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bZRzR0GrDUp43eBBETW07tKeVbD8cbWpAl1anXNhOZ7VsYwO0Q5fEAD5Z5u5gyCyfWuxR2GhdDMELYQ3IbG+UuLj1B7m78p3/iQR28PcumXkTt0EsCB+3jy3A2UPaLo/RRP5pzCMgAQ9m07CsIBmSMhZj/VldZJSzRddAX85lC2HQbI9LTfL/iy+kKH7KkPuJY8IDkYFixUm1XjhuMEK8GnnbOhWcq16iGu6JscucMMqpBNQ6V+PH6rnf18pBWZ9nd3sjN4qIg/FPt4qlDCqLJ0u1RsUeKnt9eqV0Gvg7vxaCbhRJhcWCRcsquCw0UiZSjyFNM2/x7j7TvTIuNxTXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iV36d7Y163RriNSWt0BEKbNm+c0G0egdArGn5udko+w=; b=GUEb2StWCCnbV6jvrlDsHL5dUYOGmhteQaKwXvKvs21CJ0h5j8q1monbmQ+jLGxJB63rvh7jvg5C/uHRu2x1ik33/npqIsewM1LBi1jgnOYPCtt8c84j/bMQmYSIZTy9YW40mQGJACBhjEpWW/j6aUuQSLSgJYv1lLc320akAroOnE4Akqg4xBGvu33cyeJQoi+HRUwpjhAfZ0cFeWNghD6tbpvRU2gXzq78mKMs0ifpOdGe+c7IrfYyBoHI8WhbtlqnqwBpnLtbf9sk5hSkFGsqdDxN5QR3WIlDOQHzstzYTKA0SiFgTwenu+e1u1ISl0r03hfzVBwRglLpD95q3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fujitsu.com; dmarc=pass action=none header.from=fujitsu.com; dkim=pass header.d=fujitsu.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.onmicrosoft.com; s=selector2-fujitsu-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iV36d7Y163RriNSWt0BEKbNm+c0G0egdArGn5udko+w=; b=NS4F+QJilUaL/CB41JD31YNofc4H46tHPOxDHr234YUjXaOnR6Zxq/CYJ3qLRF069D2IU/foxREL21UUcrATODHfvEhHXwsECPJHLY6ba8FwFihnvCL89s78KtNmGU1N1uhpvG44uMg3+DW9o+hJ7A3IqlguE8JgLjA0Aw99GmE= Received: from OSAPR01MB5073.jpnprd01.prod.outlook.com (20.179.179.15) by OSAPR01MB4772.jpnprd01.prod.outlook.com (20.179.177.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2559.14; Mon, 23 Dec 2019 07:43:23 +0000 Received: from OSAPR01MB5073.jpnprd01.prod.outlook.com ([fe80::c7:cff3:1b9b:bfc6]) by OSAPR01MB5073.jpnprd01.prod.outlook.com ([fe80::c7:cff3:1b9b:bfc6%3]) with mapi id 15.20.2559.017; Mon, 23 Dec 2019 07:43:23 +0000 From: "tsunakawa.takay@fujitsu.com" To: 'Tatsuo Ishii' CC: "nagata@sraoss.co.jp" , "michael@paquier.xyz" , "amitlangote09@gmail.com" , "hoshiai@sraoss.co.jp" , "alvherre@2ndquadrant.com" , "thomas.munro@gmail.com" , "kgrittn@gmail.com" , "pgsql-hackers@postgresql.org" Subject: RE: Implementing Incremental View Maintenance Thread-Topic: Implementing Incremental View Maintenance Thread-Index: AQHVoP5MW2HR/XuY5Ei0uAznagbD+KedDO2AgAADVYCAAtRJAIAAYCsAgADtLACAAF9RgIAAKwYAgAAtBQCAAAEXAIACuTAAgAFygACAABH5AIAce2QAgAAkDrCABF1hAIAAYlmQ Date: Mon, 23 Dec 2019 07:43:23 +0000 Message-ID: References: <20191202110538.a6ff2cd84f488f42eab621eb@sraoss.co.jp> <20191220140232.57b43c4f6296f793d42946b2@sraoss.co.jp> <20191223.105050.1450299519125940390.t-ishii@sraoss.co.jp> In-Reply-To: <20191223.105050.1450299519125940390.t-ishii@sraoss.co.jp> Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=tsunakawa.takay@fujitsu.com; x-originating-ip: [210.170.118.190] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 237fc810-cbed-4523-3245-08d7877bc9ba x-ms-traffictypediagnostic: OSAPR01MB4772: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 0260457E99 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(39860400002)(136003)(366004)(376002)(346002)(189003)(199004)(85182001)(54906003)(81156014)(4326008)(8676002)(33656002)(45080400002)(6916009)(55016002)(9686003)(316002)(8936002)(81166006)(478600001)(86362001)(5660300002)(64756008)(66446008)(52536014)(2906002)(71200400001)(66476007)(66946007)(76116006)(26005)(186003)(66556008)(3480700005)(7696005)(6506007)(777600001);DIR:OUT;SFP:1101;SCL:1;SRVR:OSAPR01MB4772;H:OSAPR01MB5073.jpnprd01.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a8yHlVRSvDM6k5FoSDvxJR1PviiVKmVjfqZRLXwssoJ1mDyD6Hdu7Cs2k2ek00MneNcvYJ+VRw3rkqc8IDQC0QgqI+fKvM0T3ND4pUeCqkTRGZH7ogl9jyLxSMLEP+M99hi5NRdy1nOrRBvRpZTvc6JMdDJW8+03W/fQBVK7K3Dx/of6QZp4gQnsenyDNJW93k1qzXNvYubDO7srQFsI3VXAFkFIQ3zXQfueCrydg8MoEwrmP0QeAZUo0cSLjgEiTkPwxFx85qBWbtsrbNzv8WLsAiCmyMUw1WrF/WFx3/JxLCEQNBVNdV0u0MeZWOHoms4synEDydq30jF77Z55ueP9tRhFZqshLUV8MVnRE6qDkzfEgDVhZfX23hLgf7xQqbU+K/uTiLuQijrvXmkFeMo8pyTgtvI3O6+um5OGvR4xs9c2RRumsTSIPfYiqcN0c2fPb5Uop5iVxJpf5z9Q73fvnOBk8PLdSsAan92uH8x4ZATjUZX9fgwfYYXC0ddW x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: fujitsu.com X-MS-Exchange-CrossTenant-Network-Message-Id: 237fc810-cbed-4523-3245-08d7877bc9ba X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Dec 2019 07:43:23.0675 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a19f121d-81e1-4858-a9d8-736e267fd4c7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jT7KHd+lsblsjy/qTavbhf8CcH3Jwp1UOJ7pJRFZIFQkyf/ghxG7adJS+4rQ1t3f81XVlCUgXDGDHglm7UKEW8Nw0g6vw0bkoYRfn6MoA2A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSAPR01MB4772 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk From: Tatsuo Ishii > the target data? In the discussion, someone referred to master data with= low > update frequency, because the proposed IVM implementation adds triggers o= n > source tables, which limits the applicability to update-heavy tables. >=20 > But if you want to get always up-to-data you need to pay the cost for > REFRESH MATERIALIZED VIEW. IVM gives a choice here. Thank you, that clarified to some extent. What kind of data do you think o= f as an example? Materialized view reminds me of the use in a data warehouse. Oracle handle= s the top in its Database Data Warehousing Guide, and Microsoft has just st= arted to offer the materialized view feature in its Azure Synapse Analytics= (formerly SQL Data Warehouse). AWS also has previewed Redshift's material= ized view feature in re:Invent 2019. Are you targeting the data warehouse = (analytics) workload? IIUC, to put (over) simply, the data warehouse has two kind of tables: * Facts (transaction data): e.g. sales, user activity Large amount. INSERT only on a regular basis (ETL/ELT) or continuously (st= reaming) * Dimensions (master/reference data): e.g. product, customer, time, country Small amount. Infrequently INSERTed or UPDATEd. The proposed trigger-based approach does not seem to be suitable for the fa= cts, because the trigger overhead imposed on data loading may offset or exc= eed the time saved by incrementally refreshing the materialized views. Then, does the proposed feature fit the dimension tables? If the materiali= zed view is only based on the dimension data, then the full REFRESH of the = materialized view wouldn't take so long. The typical materialized view sho= uld join the fact and dimension tables. Then, the fact table will have to = have the triggers, causing the data loading slowdown. I'm saying this because I'm concerned about the trigger based overhead. As= you know, Oracle uses materialized view logs to save changes and increment= ally apply them later to the materialized views (REFRESH ON STATEMENT mater= ialized views doesn't require the materialized view log, so it might use tr= iggers.) Does any commercial grade database implement materialized view us= ing triggers? I couldn't find relevant information regarding Azure Synapse= and Redshift. If our only handy option is a trigger, can we minimize the overhead by doin= g the view maintenance at transaction commit? Regards Takayuki Tsunakawa