From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: matview niceties: pick any two of these three |
Date: | 2013-05-04 19:30:48 |
Message-ID: | 10921.1367695848@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
... btw, I noticed a minor misfeature in the current implementation:
regression=# select pg_relation_size('int8_tbl');
pg_relation_size
------------------
8192
(1 row)
regression=# create materialized view mv1 as select * from int8_tbl;
SELECT 5
regression=# select pg_relation_size('mv1');
pg_relation_size
------------------
16384
(1 row)
So when populating a matview, we fail to make any use at all of the
initially-added page. On the other hand,
regression=# vacuum full mv1;
VACUUM
regression=# select pg_relation_size('mv1');
pg_relation_size
------------------
8192
(1 row)
regression=# refresh materialized view mv1;
REFRESH MATERIALIZED VIEW
regression=# select pg_relation_size('mv1');
pg_relation_size
------------------
16384
(1 row)
I haven't looked into why the VACUUM FULL code path is able to make use
of the initially-created page while the CREATE/REFRESH code path can't.
Possibly it's due to some innocent-looking difference in order of
operations. The details aren't really too relevant though. Rather, my
point is that IMO this sort of bug is an inevitable consequence of the
layering violation that's at the heart of the current matview design.
If we stick with this design, I'm afraid we'll be squashing bugs of this
kind till kingdom come, and some of them may be much more painful to fix
than the ones we've found to date. Layering violations tend to beget
more layering violations.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-05-04 19:59:49 | Re: erroneous restore into pg_catalog schema |
Previous Message | Stas Kelvich | 2013-05-04 19:19:23 | Re: Cube extension improvement, GSoC |