Thread: pgsql: Make TRUNCATE do truncate-in-place when processing a relation

pgsql: Make TRUNCATE do truncate-in-place when processing a relation

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Make TRUNCATE do truncate-in-place when processing a relation that was created
or previously truncated in the current (sub)transaction.  This is safe since
if the (sub)transaction later rolls back, we'd just discard the rel's current
physical file anyway.  This avoids unreasonable growth in the number of
transient files when a relation is repeatedly truncated.  Per a performance
gripe a couple weeks ago from Todd Cook.

Modified Files:
--------------
    pgsql/src/backend/catalog:
        heap.c (r1.357 -> r1.358)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c?r1=1.357&r2=1.358)
    pgsql/src/backend/commands:
        tablecmds.c (r1.297 -> r1.298)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.297&r2=1.298)
    pgsql/src/include/catalog:
        heap.h (r1.91 -> r1.92)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/heap.h?r1=1.91&r2=1.92)