Re: counting algorithm for incremental matview maintenance

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: counting algorithm for incremental matview maintenance
Date: 2013-05-17 21:12:37
Message-ID: 51969D45.4080702@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kevin,

> The count_t column saves us from having to scan foo for all the old
> val values. It does not require any scan of the entire bar
> matview. It allows us to zero in on exactly the right rows, and
> lets us know what needs doing.

This sounds like a fairly good approach. It would require a couple of
things though:

1) admins would need to be able to enable and disable incremental
updating of matviews, so that if the creation of delta tables is bogging
down writes, they can disable them temporarily as a performance workaround.

2) if an admin enables incremental updating of an existing matview, it
would need to be REFRESHed immediately before we could start
incrementally updating it. So an ENABLE should call a REFRESH.

> Hopefully this makes it fairly clear that the only thing that an
> optimization around the "append-only" assertion for a matview would
> be the ability to skip the probe for an existing record *related to
> rows which are in the delta*. As long as there is reasonable
> indexing on the matview, maintenance for the append-only case would
> not involve scanning the entire matview.

Yeah, given what you've explained, my first inclination would be just to
let the counting do its thing and see how slow/expensive it is before we
try further optimizations.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2013-05-17 21:14:05 Re: askpass program for libpq
Previous Message Daniel Farina 2013-05-17 21:03:20 Re: askpass program for libpq