aboutsummaryrefslogtreecommitdiff
path: root/src/include/access/hio.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-11-06 20:51:15 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-11-06 20:51:15 +0000
commit85e2cedf985bfecaf43a18ca17433070f439fb0e (patch)
tree9348349050eaa2a8a863297c88502263c3a2e338 /src/include/access/hio.h
parentcdc197cf3100359cd436757adc0002dad07e3117 (diff)
downloadpostgresql-85e2cedf985bfecaf43a18ca17433070f439fb0e.tar.gz
postgresql-85e2cedf985bfecaf43a18ca17433070f439fb0e.zip
Improve bulk-insert performance by keeping the current target buffer pinned
(but not locked, as that would risk deadlocks). Also, make it work in a small ring of buffers to avoid having bulk inserts trash the whole buffer arena. Robert Haas, after an idea of Simon Riggs'.
Diffstat (limited to 'src/include/access/hio.h')
-rw-r--r--src/include/access/hio.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/include/access/hio.h b/src/include/access/hio.h
index a089bddbf3f..813347dccbe 100644
--- a/src/include/access/hio.h
+++ b/src/include/access/hio.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/hio.h,v 1.36 2008/06/19 00:46:06 alvherre Exp $
+ * $PostgreSQL: pgsql/src/include/access/hio.h,v 1.37 2008/11/06 20:51:15 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,9 +18,26 @@
#include "utils/relcache.h"
#include "storage/buf.h"
+
+/*
+ * state for bulk inserts --- private to heapam.c and hio.c
+ *
+ * If current_buf isn't InvalidBuffer, then we are holding an extra pin
+ * on that buffer.
+ *
+ * "typedef struct BulkInsertStateData *BulkInsertState" is in heapam.h
+ */
+typedef struct BulkInsertStateData
+{
+ BufferAccessStrategy strategy; /* our BULKWRITE strategy object */
+ Buffer current_buf; /* current insertion target page */
+} BulkInsertStateData;
+
+
extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
HeapTuple tuple);
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
- Buffer otherBuffer, bool use_fsm);
+ Buffer otherBuffer, int options,
+ struct BulkInsertStateData *bistate);
#endif /* HIO_H */