Re: Postgres 9.6 - ltree extension - (re)build a tree on a table

"David G. Johnston" <[email protected]>
Newsgroups gmane.comp.db.postgresql.sql
Message-ID <CAKFQuwYggqUSW_yTui5U+1PzEK1+UA7zcj+4MepWV95tKD-NCQ@mail.gmail.com>
On Tue, Apr 17, 2018 at 3:11 AM, Luca <[email protected]> wrote:

> Since this table should be updated after a data import, so after a massive
> upsert, ideally I would i'd like to have a function
> called after that is completed, in order to (re)build the 'path' column
> for each record, which means rebuild the tree.
>

​Have you considered/tried an "FOR EACH STATEMENT" trigger instead of "FOR
EACH ROW"​?

The transition tables feature introduced in v10 probably will be of
significant help here as well - though I haven't any practical experience
with it personally.

https://www.postgresql.org/docs/current/static/sql-createtrigger.html

David J.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.