PostgreSQL源码学习删除数据#1,2

database

本节介绍heapam_tuple_delete和table_tuple_delete函数。

heapam_tuple_delete函数

//src/backend/access/heap/heapam_handler.c

static TM_Result

heapam_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,

Snapshot snapshot, Snapshot crosscheck, bool wait,

TM_FailureData *tmfd, bool changingPart)

{

/* 目前,索引元组的删除是在vacuum时处理的 */

return heap_delete(relation, tid, cid, crosscheck, wait, tmfd, changingPart);

}

table_tuple_delete函数

//src/backend/access/heap/heapam_handler.c

static inline TM_Result

table_tuple_delete(Relation rel, ItemPointer tid, CommandId cid,

Snapshot snapshot, Snapshot crosscheck, bool wait,

TM_FailureData *tmfd, bool changingPart)

{

/* 默认的表存储引擎的话,rd_tableam赋值为heapam_methods,

其tuple_delete指向的就是heapam_tuple_delete函数 */

return rel->rd_tableam->tuple_delete(rel, tid, cid,

snapshot, crosscheck,

wait, tmfd, changingPart);

}

以上是 PostgreSQL源码学习删除数据#1,2 的全部内容, 来源链接: utcz.com/z/534050.html

回到顶部