diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-20 18:37:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-20 18:37:02 +0000 |
commit | b95ae32b4178959e8880bd716fb33ec163f61713 (patch) | |
tree | 316fdc43f11fb9f859d4d9721287f85b9b44db68 /src/backend/storage | |
parent | 1bfdd1a89321c390201ebe15fe47571f54f9c80a (diff) | |
download | postgresql-b95ae32b4178959e8880bd716fb33ec163f61713.tar.gz postgresql-b95ae32b4178959e8880bd716fb33ec163f61713.zip |
Avoid WAL-logging individual tuple insertions during CREATE TABLE AS
(a/k/a SELECT INTO). Instead, flush and fsync the whole relation before
committing. We do still need the WAL log when PITR is active, however.
Simon Riggs and Tom Lane.
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/smgr/md.c | 5 | ||||
-rw-r--r-- | src/backend/storage/smgr/smgr.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 1c0cb7e240b..fa7913aff74 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.115 2005/05/29 04:23:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.116 2005/06/20 18:37:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -660,6 +660,9 @@ mdtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp) /* * mdimmedsync() -- Immediately sync a relation to stable storage. + * + * Note that only writes already issued are synced; this routine knows + * nothing of dirty buffers that may exist inside the buffer manager. */ bool mdimmedsync(SMgrRelation reln) diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index 2c8cf07eec8..f286b20ee25 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.90 2005/06/17 22:32:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.91 2005/06/20 18:37:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -650,7 +650,8 @@ smgrtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp) /* * smgrimmedsync() -- Force the specified relation to stable storage. * - * Synchronously force all of the specified relation down to disk. + * Synchronously force all previous writes to the specified relation + * down to disk. * * This is useful for building completely new relations (eg, new * indexes). Instead of incrementally WAL-logging the index build @@ -664,6 +665,10 @@ smgrtruncate(SMgrRelation reln, BlockNumber nblocks, bool isTemp) * * The preceding writes should specify isTemp = true to avoid * duplicative fsyncs. + * + * Note that you need to do FlushRelationBuffers() first if there is + * any possibility that there are dirty buffers for the relation; + * otherwise the sync is not very meaningful. */ void smgrimmedsync(SMgrRelation reln) |