NJ_315
NJ_315

Reputation: 1883

Auto update 2 tables after linking them

I have one table with data say 100 records(1st table).

I create a blank table(2nd table).

I want to link or copy the data from the first table into the new blank table.

When the 1st table is updated , this updation should happen in the 2nd table also.

Is this possible?

Upvotes: 0

Views: 79

Answers (2)

Up_One
Up_One

Reputation: 5271

Hy @DrewRose, I think what you are looking for is a trigger event, well Vertica does not support triggers!
What to use to give business logic in Vertica:

  • Vertica supports and provides ODBC/JDBC/ADO.NET interfaces.
  • Vertica provides SDK for UDF on C/C++ and R-language

    Remeber that Vertica is MPP and is not fit for a high transactional environment, this may slow down your database.
    How would i do it !

  • 1- i would check to see if Vertica does not carry already a tool to fix this for me !


For example :
- if you table is not a huge table you can use the MERGE Statement from vertica, is a native function and is quite fast. Take a look at this link to see it in more detail.

  • 2- i would try to fix this logic at loading time. See the link for more loading techniques.

  • 3- i would create a UDF to work with my layout.

Here is a link to get you started with Vertica UDF's(user defined functions).

Place a real example for us(load type,tables,etc..) , maybe there is a simple fix ! for it !

Upvotes: 1

Kermit
Kermit

Reputation: 34063

Until we get further clarification on what your specific needs are, I would recommend creating a view that represents all or a subset of the data of the parent table. The results of the view would be obtained on the fly ensuring that the latest data is present.

Upvotes: 0

Related Questions