Files
doris/docs/zh-CN/sql-reference/sql-statements/Data Manipulation/SHOW-LAST-INSERT.md
Mingyu Chen 1e70f992e7 [improvement][fix](insert)(replay) support SHOW LAST INSERT stmt and fix json replay bug (#8355)
1. support SHOW LAST INSERT
    In the current implementation, the insert operation returns a json string to describe the result information
    of the insert. But this information is in the session track field of the mysql protocol,
    and it is difficult to obtain programmatically.

    Therefore, I provide a new syntax `show last insert` to explicitly obtain the result of the latest insert operation,
    and return a normal query result set to facilitate the user to obtain the result information of the insert.

2. the `ReturnRows` field in fe.audit.log of insert operation will be set to the loaded row num of the insert.

3.  Fix a bug described in #8354
2022-03-08 18:53:11 +08:00

1.7 KiB

title, language
title language
SHOW LAST INSERT zh-CN

SHOW LAST INSERT

description

该语法用于查看在当前session连接中,最近一次 insert 操作的结果

语法:

SHOW LAST INSERT

返回结果示例:

    TransactionId: 64067
            Label: insert_ba8f33aea9544866-8ed77e2844d0cc9b
         Database: default_cluster:db1
            Table: t1
TransactionStatus: VISIBLE
       LoadedRows: 2
     FilteredRows: 0
  • TransactionId:事务id
  • Label:insert任务对应的 label
  • Database:insert对应的数据库
  • Table:insert对应的表
  • TransactionStatus:事务状态
    • PREPARE:准备阶段
    • PRECOMMITTED:预提交阶段
    • COMMITTED:事务成功,但数据不可见
    • VISIBLE:事务成功且数据可见
    • ABORTED:事务失败
  • LoadedRows:导入的行数
  • FilteredRows:被过滤的行数

example

keyword

SHOW, LAST, INSERT