LightDB - append hint

在 oracle 中插入有两种模式:

  • 传统插入:插入的时候使用表中已有的空闲空间,同时会经过buffer cache,在插入的过程中会维护引用完整性约束
  • direct-path 插入:插入的时候不使用表中已有的空闲空间,直接在已有数据之后追加数据(直接在表的高水位线(HWM)以上插入), 经过buffer cache,直接插入数据文件,并且在插入的过程中不会维护引用完整性约束

可以通过使用 append hint 对insert select 语句使用 direct-path insert
LightDB 从23.4 开始支持 append hint, 但由于LightDB 不支持 direct-path insert, 因此即使使用了hint,也不会起效。目前只是为了兼容这种用法。
下面对使用方法举例:

示例

初始化

create table test_append(key1 int, key2 int, key3 int, key4 int);
create table test_append1(key1 int, key2 int, key3 int, key4 int);

insert into test_append1 values(1,2,3,4);
insert into test_append1 values(11,21,31,41);
insert into test_append1 values(111,211,311,411);

示例

lightdb@test_oracle_pg_hint_plan=# EXPLAIN (COSTS FALSE) insert/*+append */ into test_append select 1, 1, 1, 2 from dual;
LOG:  lt_hint_plan:
used hint:
not used hint:
append
duplication hint:
error hint:

          QUERY PLAN           
-------------------------------
 Insert on test_append @"lt#1"
   ->  Result
(2 rows)

lightdb@test_oracle_pg_hint_plan=# EXPLAIN (COSTS FALSE) insert/*+append */ into test_append select * from test_append1;
LOG:  lt_hint_plan:
used hint:
not used hint:
append
duplication hint:
error hint:

           QUERY PLAN           
--------------------------------
 Insert on test_append @"lt#1"
   ->  Seq Scan on test_append1
(2 rows)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

紫无之紫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值