How to optimize Vertica Merge statement performance
When using Merge Vertica will pick the best projection available for the merge statement, for this is important that you provide Vertica with optimized projections.
When Vertica makes use of good projections the need of additional sort and data transfer operation is not needed with this making the Merge more efficient.
Important condition to get an optimized Merge statement.
an unique of primary key must be used in the join operation
update and insert clauses should include every column in the target table
update and insert clause attributes should be identical
Very Important: - all of the above must be meet in order for the Merge run with an optimized query plan.
Now let's go to work and see how this apply's and how can we spot a optimized and non-optimized Merge query plan.
How to determine a optimized and non-optimized Merge query plan.
A a Semi path indicates the statement is eligible for optimization, whereas a Right Outer path indicates the statement is ineligible and will run with the same performance as MERGE in previous releases unless a duplicate merge join key is encountered at query run time.