diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 19:19:57 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-07 19:19:57 +0000 |
commit | 24ee8af57378ee3b065f6a0d62aeb5a5c7313284 (patch) | |
tree | a6cac1fd93221aad889f8f869d8fdbc97ff8834b /src/backend/executor/nodeHash.c | |
parent | 2d9d7a6bf56801e38ba93e22346a5ef3b9ac73ea (diff) | |
download | postgresql-24ee8af57378ee3b065f6a0d62aeb5a5c7313284.tar.gz postgresql-24ee8af57378ee3b065f6a0d62aeb5a5c7313284.zip |
Rework temp_tablespaces patch so that temp tablespaces are assigned separately
for each temp file, rather than once per sort or hashjoin; this allows
spreading the data of a large sort or join across multiple tablespaces.
(I remain dubious that this will make any difference in practice, but certain
people insisted.) Arrange to cache the results of parsing the GUC variable
instead of recomputing from scratch on every demand, and push usage of the
cache down to the bottommost fd.c level.
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r-- | src/backend/executor/nodeHash.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index 348606e88bb..b5cabd81a4f 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.113 2007/06/03 17:07:14 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.114 2007/06/07 19:19:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -267,7 +267,6 @@ ExecHashTableCreate(Hash *node, List *hashOperators) hashtable->totalTuples = 0; hashtable->innerBatchFile = NULL; hashtable->outerBatchFile = NULL; - hashtable->hashTblSpc = InvalidOid; hashtable->spaceUsed = 0; hashtable->spaceAllowed = work_mem * 1024L; @@ -327,8 +326,8 @@ ExecHashTableCreate(Hash *node, List *hashOperators) hashtable->outerBatchFile = (BufFile **) palloc0(nbatch * sizeof(BufFile *)); /* The files will not be opened until needed... */ - /* ... but we want to choose the tablespace only once */ - hashtable->hashTblSpc = GetTempTablespace(); + /* ... but make sure we have temp tablespaces established for them */ + PrepareTempTablespaces(); } /* @@ -510,8 +509,8 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) palloc0(nbatch * sizeof(BufFile *)); hashtable->outerBatchFile = (BufFile **) palloc0(nbatch * sizeof(BufFile *)); - /* time to choose the tablespace, too */ - hashtable->hashTblSpc = GetTempTablespace(); + /* time to establish the temp tablespaces, too */ + PrepareTempTablespaces(); } else { @@ -564,8 +563,7 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) { /* dump it out */ Assert(batchno > curbatch); - ExecHashJoinSaveTuple(hashtable, - HJTUPLE_MINTUPLE(tuple), + ExecHashJoinSaveTuple(HJTUPLE_MINTUPLE(tuple), tuple->hashvalue, &hashtable->innerBatchFile[batchno]); /* and remove from hash table */ @@ -657,8 +655,7 @@ ExecHashTableInsert(HashJoinTable hashtable, * put the tuple into a temp file for later batches */ Assert(batchno > hashtable->curbatch); - ExecHashJoinSaveTuple(hashtable, - tuple, + ExecHashJoinSaveTuple(tuple, hashvalue, &hashtable->innerBatchFile[batchno]); } |