Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFmyy-0002ic-Sa for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Jul 2023 02:38:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qFmyx-0005AV-FO for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Jul 2023 02:38:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFmyx-0005AM-5n for pgsql-hackers@lists.postgresql.org; Sun, 02 Jul 2023 02:38:35 +0000 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qFmyu-001fyR-I5 for pgsql-hackers@postgresql.org; Sun, 02 Jul 2023 02:38:34 +0000 Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-7653bd3ff2fso348192485a.3 for ; Sat, 01 Jul 2023 19:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688265511; x=1690857511; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dFLeCzwLtYywd2LzgCUJI3LfW36MYNUmS4bgZtes2Ew=; b=p0f98Bh7t/givvgc7jL/ktnU98Ewd0broVooHa1uVQHgppxSUDZLz5pnI8StJPfkLK BpSx8MPrAV8GyGOg2p3fSdi5ZHgmVyMlwHDf2rTIZXdK/+AzUmrO5Chg9DPJnxJdRLqS vcI5e6qssCH/O+lkMK+g7m4k8hqUEuvlaJG4c+5ir7kK0VipWTr5hPfHR3O+Uoq1wPuC 6SGBZwtrYG0PCwQvi5Gmc/c6c5FWaXAeLGeQndBP8nnBxr0xGS+H4cg/9cUo5YQGOxYz OVK+c1q91TO9kVmDYTg06fexhy+4//k7cnlf0BsK653sAkL3jOkMZt+hDNa2tWi0FR8z IBrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688265511; x=1690857511; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dFLeCzwLtYywd2LzgCUJI3LfW36MYNUmS4bgZtes2Ew=; b=h5CsX9qkiTFiJLdWfqpmeen4RCVW9fwRCuKce6fsjXbqxbaKHLKwoOVmVQzsjYuhPr cQfo4TcMNV+a5fEqU9Mm2pqW/npeeoKQJVFPMQr0LpBXY+GQWXnmoAN5sJxMUdt7KH69 +AJzSbsr1BCQT0llL2yYwGyLC4JAzZ7SeXw0AcXnbdXh2nY8b4yjLP1viHqHqw4toNKR bOeozGBUevcI6uSsPzw21U1ldtg+g9LIqUhu2Gl/6iQny/ZQ1+/uMr47k6RKeF2sjXG8 YXJcjW0SI+l9qOwPLZJ/SU/56co4S2meWsM6oFttmvb//KTJHQpntqtUfLdmyR3lgjNP Ws6g== X-Gm-Message-State: ABy/qLbUar9RrY+Ke+tT65DgusNvu38OyJANjmv97hG7A2ChdbVuBv88 EB15SAFwIYyyvpXuq6nLtzb20KXLIuFlCQJzFR4= X-Google-Smtp-Source: ACHHUZ4Il0HZlGDOGwtDQPTcePTL+aUVJNqY6Wsf6wLeSmujFBkDH7qq1yezJSAqnAADg+cdQ84yRGIs4Tv/0lBcof0= X-Received: by 2002:a05:620a:4593:b0:765:a633:43f2 with SMTP id bp19-20020a05620a459300b00765a63343f2mr9277268qkb.12.1688265510923; Sat, 01 Jul 2023 19:38:30 -0700 (PDT) MIME-Version: 1.0 References: <20230601235909.0e1572c27e59112f9d0cbe86@sraoss.co.jp> <20230601034703.9e4f81f5d92ae6e3949b84d2@sraoss.co.jp> <20230628170604.505955118ac2f91abd554f13@sraoss.co.jp> In-Reply-To: From: jian he Date: Sun, 2 Jul 2023 10:38:20 +0800 Message-ID: Subject: Re: Incremental View Maintenance, take 2 To: Yugo NAGATA Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ok. Now I really found a small bug. this works as intended: BEGIN; CREATE INCREMENTAL MATERIALIZED VIEW test_ivm AS SELECT i, MIN(j) as min_j FROM mv_base_a group by 1; INSERT INTO mv_base_a select 1,-2 where false; rollback; however the following one: BEGIN; CREATE INCREMENTAL MATERIALIZED VIEW test_ivm1 AS SELECT MIN(j) as min_j FROM mv_base_a; INSERT INTO mv_base_a select 1, -2 where false; rollback; will evaluate tuplestore_tuple_count(new_tuplestores) to 1, it will walk through IVM_immediate_maintenance function to apply_delta. but should it be zero?