Working with Merge in Vertica
In this article we will talk about the Merge operation in HP Vertica.
What is Merge and why is important to know how to use it while working with Vertica ?
MERGE statement combines insert and update operations into a single operation.
Syntax for Merge
- you must have select permission on the source table and insert,update and delete on the target table.
Important:
- during the merge operation an exclusive lock will be required.
Examples of merge operations
- Table we will use for this demonstration
- Target Table Result Set before Merge
- Executing the Merge Statement
- this is a simple merge statement that includes both MATCHED and NOT MATCHED options.
Description of the action that merge statement did.
- WHEN MATCHED - an update statement will be executed
- WHEN NOT MATCHED - an insert statement will be executed (this is optional)
To see how improve MERGE performance follow this article.