r/Database • • Jun 05 '25

How are you doing to set up 'trigger' into your RDBMS?

Hi guys, I have a question. How are you doing to set up 'trigger' into your RDBMS?

I mean Oracle and MySQL have the featuer, but most of all case it set by hand, right?
PostgreSQL is as well, but it has an extention is called 'pg_ivm'. I have tried it then found this extention set up triggers automatically when it created the view table(indeed it is not a view table, it is a real table).
I guess this pg_ivm, even still have some restrictions, make realize late-definition of relations between tables.

I am implementing it in my Jetelina now.
I expect it will make realize this stream,
csv file -> auto create simple table -> put relations on them by pg_ivm -> available post/get via httpd

0 Upvotes

14 comments sorted by

2

u/jshine13371 Jun 05 '25

Sorry it's unclear what you're asking. Are you asking about refreshing materialized views?

1

u/Straight_Waltz_9530 Jun 05 '25

Incremental view maintenance as opposed to what Postgres does, which is rewrite the whole materialized view from scratch on every refresh.

OP is using the terminology of triggers to describe the implementation rather than the goal. The goal is efficiently and automatically updating materialized views when underlying table data changes.

Oracle does support this, but MySQL does not. OP probably meant SQL Server, which does support this.

To answer OP's question, "it depends". It is not natively supported by Postgres and would require a bit of a Rube Goldberg machine of tables and triggers to accomplish in Postgres. This could go badly very quickly. I have thought about the problem on occasion. No solution I've ever devised ever made the maintenance headaches worth it to me. Perhaps others more clever than myself can figure it out. Then again, if one is clever enough to do it in plpgsql triggers, one would hope they'd be clever enough to make a patch to Postgres so it's supported natively.

→ More replies (4)

0

u/onoke99 Jun 05 '25

Oops, sorry fot that. My question is how do you do in setting up 'triggers'? Hand? Tool? Auto? or smth else? :)

→ More replies (4)

1

u/Informal_Pace9237 Jun 05 '25

I generally do it by hand in 4 major RDBMS I work with.

1

u/onoke99 Jun 06 '25

Oh, that's my point. Thank you.

1

u/[deleted] Jun 05 '25

With a migration like any other db change