mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Create a GUC parameter temp_tablespaces that allows selection of the
tablespace(s) in which to store temp tables and temporary files. This is a list to allow spreading the load across multiple tablespaces (a random list element is chosen each time a temp object is to be created). Temp files are not stored in per-database pgsql_tmp/ directories anymore, but per-tablespace directories. Jaime Casanova and Albert Cervera, with review by Bernd Helmle and Tom Lane.
This commit is contained in:
@@ -70,13 +70,14 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/sort/logtape.c,v 1.23 2007/01/05 22:19:47 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/sort/logtape.c,v 1.24 2007/06/03 17:08:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "commands/tablespace.h"
|
||||
#include "storage/buffile.h"
|
||||
#include "utils/logtape.h"
|
||||
|
||||
@@ -528,7 +529,7 @@ LogicalTapeSetCreate(int ntapes)
|
||||
Assert(ntapes > 0);
|
||||
lts = (LogicalTapeSet *) palloc(sizeof(LogicalTapeSet) +
|
||||
(ntapes - 1) *sizeof(LogicalTape));
|
||||
lts->pfile = BufFileCreateTemp(false);
|
||||
lts->pfile = BufFileCreateTemp(false, GetTempTablespace());
|
||||
lts->nFileBlocks = 0L;
|
||||
lts->forgetFreeSpace = false;
|
||||
lts->blocksSorted = true; /* a zero-length array is sorted ... */
|
||||
|
@@ -38,7 +38,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.31 2007/05/21 17:57:34 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/sort/tuplestore.c,v 1.32 2007/06/03 17:08:26 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "commands/tablespace.h"
|
||||
#include "executor/executor.h"
|
||||
#include "storage/buffile.h"
|
||||
#include "utils/memutils.h"
|
||||
@@ -424,8 +425,14 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple)
|
||||
|
||||
/*
|
||||
* Nope; time to switch to tape-based operation.
|
||||
*
|
||||
* If the temp table is slated to outlive the current transaction,
|
||||
* force it into my database's default tablespace, so that it will
|
||||
* not pose a threat to possible tablespace drop attempts.
|
||||
*/
|
||||
state->myfile = BufFileCreateTemp(state->interXact);
|
||||
state->myfile = BufFileCreateTemp(state->interXact,
|
||||
state->interXact ? InvalidOid :
|
||||
GetTempTablespace());
|
||||
state->status = TSS_WRITEFILE;
|
||||
dumptuples(state);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user