Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT
От
Heikki Linnakangas
Тема
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables
on COMMIT
Дата
Msg-id
51067F8C.5010306@vmware.com
Ответ на
Список
Дерево обсуждения
Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT Gurjeet Singh <singh.gurjeet@gmail.com>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT Tom Lane <tgl@sss.pgh.pa.us>
Re: Patches for TODO item: Avoid truncating empty OCDR temp
tables on COMMIT Gurjeet Singh <singh.gurjeet@gmail.com>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT Tom Lane <tgl@sss.pgh.pa.us>
Re: Patches for TODO item: Avoid truncating empty OCDR temp
tables on COMMIT Robert Haas <robertmhaas@gmail.com>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT Tom Lane <tgl@sss.pgh.pa.us>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables
on COMMIT Heikki Linnakangas <hlinnakangas@vmware.com>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables on COMMIT Robert Haas <robertmhaas@gmail.com>
Re: Patches for TODO item: Avoid truncating empty OCDR temp tables
on COMMIT Heikki Linnakangas <hlinnakangas@vmware.com>
On 15.01.2013 21:03, Tom Lane wrote:
> Robert Haas writes:
>> On the third hand, the fact that a table is OCDR is recorded in
>> backend-local storage somewhere, and that storage (unlike the
>> relcache) had better be reliable. So maybe there's some way to
>> finesse it that way.
>
> Hm, keep a flag in that storage you mean? Yeah, that could possibly
> work.
Sounds reasonable.
Until someone gets around to write a patch along those lines, I'm
inclined to apply this one liner:
*** a/src/backend/commands/tablecmds.c
--- b/src/backend/commands/tablecmds.c
***************
*** 10124,10130 **** PreCommit_on_commit_actions(void) /* Do nothing (there shouldn't be such entries, actually) */ break; case ONCOMMIT_DELETE_ROWS:
! oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid); break; case ONCOMMIT_DROP: {
--- 10124,10136 ---- /* Do nothing (there shouldn't be such entries, actually) */ break; case ONCOMMIT_DELETE_ROWS:
! /*
! * If this transaction hasn't accessed any temporary relations,
! * we can skip truncating ON COMMIT DELETE ROWS tables, as
! * they must still be empty.
! */
! if (MyXactAccessedTempRel)
! oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid); break; case ONCOMMIT_DROP: {
We already have that MyXactAccessedTempRel global flag. Just checking
that should cover many common cases.
- Heikki
В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата: