Vertica 没有优化合并

Vertica didn't optimized merge

我在 vertica DB 中创建了 2 个表

WAREHOUSE.ALL_EVENTS 
WAREHOUSE.BUF_ALL_EVENTS

在 WAREHOUSE.BUF_ALL_EVENTS 我从文件上传数据

开始合并后

MERGE INTO WAREHOUSE.ALL_EVENTS be 
USING WAREHOUSE.BUF_ALL_EVENTS buf ON be.id=buf.id 
WHEN MATCHED THEN UPDATE SET 
  id=buf.id                                 ,
  version=buf.version                       ,
  title=buf.title                         ,
  description=buf.description                   ,
  solution=buf.solution                      ,
  state=buf.state                         ,
  severity=buf.severity                      ,
  priority=buf.priority                     ,
  category=buf.category                      ,
  subcategory=buf.subcategory                   ,
  type=buf.type                          ,
  related_ci_hint=buf.related_ci_hint               ,
  om_service_id=buf.om_service_id                 ,
  related_ci_id=buf.related_ci_id                 ,
  related_ci_type=buf.related_ci_type               ,
  node_id=buf.node_id                       ,
  node_type=buf.node_type                     ,
  sequence_number=buf.sequence_number               ,
  nodehints_hint=buf.nodehints_hint                ,
  nodehints_dnsname=buf.nodehints_dnsname             ,
  nodehints_ipaddress=buf.nodehints_ipaddress           ,
  nodehints_coreid=buf.nodehints_coreid              ,
  sourcecihints_hint=buf.sourcecihints_hint            ,
  sourcecihints_dnsname=buf.sourcecihints_dnsname         ,
  sourcecihints_ipaddress=buf.sourcecihints_ipaddress       ,
  sourcecihints_coreid=buf.sourcecihints_coreid          ,
  originating_dnsname=buf.originating_dnsname           ,
  originating_ipaddress=buf.originating_ipaddress         ,
  originating_coreid=buf.originating_coreid            ,
  sending_dnsname=buf.sending_dnsname               ,
  sending_ipaddress=buf.sending_ipaddress             ,
  sending_coreid=buf.sending_coreid                ,
  om_user=buf.om_user                       ,
  assigned_user=buf.assigned_user                 ,
  assigned_group=buf.assigned_group               ,
  cause_id=buf.cause_id                      ,
  time_created=buf.time_created                  ,
  time_changed=buf.time_changed                  ,
  time_state_changed=buf.time_state_changed            ,
  time_received=buf.time_received                 ,
  duplicate_count=buf.duplicate_count               ,
  eti_hint=buf.eti_hint                      ,
  eti_subcomponent_id=buf.eti_subcomponent_id           ,
  ua_host_dnsname=buf.ua_host_dnsname               ,
  ua_host_ipaddress=buf.ua_host_ipaddress             ,
  ua_host_coreid=buf.ua_host_coreid                ,
  ua_call=buf.ua_call                       ,
  ua_status=buf.ua_status                     ,
  ua_add_anno=buf.ua_add_anno                  ,
  ua_will_resolve=buf.ua_will_resolve               ,
  aa_host_dnsname=buf.aa_host_dnsname               ,
  aa_host_ipaddress=buf.aa_host_ipaddress             ,
  aa_host_coreid=buf.aa_host_coreid                ,
  aa_call=buf.aa_call                       ,
  aa_status=buf.aa_status                     ,
  aa_add_anno=buf.aa_add_anno                   ,
  aa_will_resolve=buf.aa_will_resolve               ,
  application=buf.application                   ,
  object=buf.object                        ,
  event_key=buf.event_key                     ,
  close_key_pattern=buf.close_key_pattern             ,
  original_data=buf.original_data                 ,
  log_only=buf.log_only                      ,
  no_dedup=buf.no_dedup                      ,
  received_on_ci_downtime=buf.received_on_ci_downtime       ,
  instruction_available=buf.instruction_available         ,
  source_ci_id=buf.source_ci_id                  ,
  source_ci_type=buf.source_ci_type                ,
  policy_type=buf.policy_type                   ,
  policy_name=buf.policy_name                   ,
  condition_id=buf.condition_id                  ,
  condition_name=buf.condition_name                ,
  original_id=buf.original_id                   ,
  correlation_type=buf.correlation_type              ,
  correlation_rule_id=buf.correlation_rule_id           ,
  correlation_weight=buf.correlation_weight            ,
  eti_indicator_id=buf.eti_indicator_id              ,
  eti_value_id=buf.eti_value_id                  ,
  eti_reset_value_id=buf.eti_reset_value_id            ,
  eti_numeric_value=buf.eti_numeric_value             ,
  control_dnsname=buf.control_dnsname               ,
  control_server_port=buf.control_server_port           ,
  control_server_id=buf.control_server_id             ,
  control_external_id=buf.control_external_id           ,
  control_external_url=buf.control_external_url          ,
  rule_name=buf.rule_name                     ,
  transfer_state=buf.transfer_state                ,
  initiated_by_id=buf.initiated_by_id               ,
  source_dnsname=buf.source_dnsname                ,
  source_ia_management_port=buf.source_ia_management_port     ,
  source_ia_management_protocol=buf.source_ia_management_protocol ,
  source_server_id=buf.source_server_id              ,
  source_external_id=buf.source_external_id            ,
  source_external_url=buf.source_external_url           ,
  cires_hint_count=buf.cires_hint_count              ,
  cires_matched_hint_count=buf.cires_matched_hint_count      ,
  cires_quality_metric=buf.cires_quality_metric          ,
  cires_status=buf.cires_status                  ,
  received_as_notify=buf.received_as_notify            
WHEN NOT MATCHED THEN INSERT
VALUES
(
  buf.id                            ,
  buf.version                       ,
  buf.title                         ,
  buf.description                   ,
  buf.solution                      ,
  buf.state                         ,
  buf.severity                      ,
  buf.priority                      ,
  buf.category                      ,
  buf.subcategory                   ,
  buf.type                          ,
  buf.related_ci_hint               ,
  buf.om_service_id                 ,
  buf.related_ci_id                 ,
  buf.related_ci_type               ,
  buf.node_id                       ,
  buf.node_type                     ,
  buf.sequence_number               ,
  buf.nodehints_hint                ,
  buf.nodehints_dnsname             ,
  buf.nodehints_ipaddress           ,
  buf.nodehints_coreid              ,
  buf.sourcecihints_hint            ,
  buf.sourcecihints_dnsname         ,
  buf.sourcecihints_ipaddress       ,
  buf.sourcecihints_coreid          ,
  buf.originating_dnsname           ,
  buf.originating_ipaddress         ,
  buf.originating_coreid            ,
  buf.sending_dnsname               ,
  buf.sending_ipaddress             ,
  buf.sending_coreid                ,
  buf.om_user                       ,
  buf.assigned_user                 ,
  buf.assigned_group                ,
  buf.cause_id                      ,
  buf.time_created                  ,
  buf.time_changed                  ,
  buf.time_state_changed            ,
  buf.time_received                 ,
  buf.duplicate_count               ,
  buf.eti_hint                      ,
  buf.eti_subcomponent_id           ,
  buf.ua_host_dnsname               ,
  buf.ua_host_ipaddress             ,
  buf.ua_host_coreid                ,
  buf.ua_call                       ,
  buf.ua_status                     ,
  buf.ua_add_anno                   ,
  buf.ua_will_resolve               ,
  buf.aa_host_dnsname               ,
  buf.aa_host_ipaddress             ,
  buf.aa_host_coreid                ,
  buf.aa_call                       ,
  buf.aa_status                     ,
  buf.aa_add_anno                   ,
  buf.aa_will_resolve               ,
  buf.application                   ,
  buf.object                        ,
  buf.event_key                     ,
  buf.close_key_pattern             ,
  buf.original_data                 ,
  buf.log_only                      ,
  buf.no_dedup                      ,
  buf.received_on_ci_downtime       ,
  buf.instruction_available         ,
  buf.source_ci_id                  ,
  buf.source_ci_type                ,
  buf.policy_type                   ,
  buf.policy_name                   ,
  buf.condition_id                  ,
  buf.condition_name                ,
  buf.original_id                   ,
  buf.correlation_type              ,
  buf.correlation_rule_id           ,
  buf.correlation_weight            ,
  buf.eti_indicator_id              ,
  buf.eti_value_id                  ,
  buf.eti_reset_value_id            ,
  buf.eti_numeric_value             ,
  buf.control_dnsname               ,
  buf.control_server_port           ,
  buf.control_server_id             ,
  buf.control_external_id           ,
  buf.control_external_url          ,
  buf.rule_name                     ,
  buf.transfer_state                ,
  buf.initiated_by_id               ,
  buf.source_dnsname                ,
  buf.source_ia_management_port     ,
  buf.source_ia_management_protocol ,
  buf.source_server_id              ,
  buf.source_external_id            ,
  buf.source_external_url           ,
  buf.cires_hint_count              ,
  buf.cires_matched_hint_count      ,
  buf.cires_quality_metric          ,
  buf.cires_status                  ,
  buf.received_as_notify         
)
;

操作完成OK,但是等了很长时间。

我已从使用 MERGE 更新 100 万行中阅读有关优化的信息 Conditions for an Optimized MERGE

看起来没问题,但是优化的 MERGE 不起作用...如何解决这个问题?

经过验证 table 对象确实在 WAREHOUSE.BUF_ALL_EVENTS 中发现缺少主键。这个错误没有优化合并。