1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Arrange to put TOAST tables belonging to temporary tables into special schemas

named pg_toast_temp_nnn, alongside the pg_temp_nnn schemas used for the temp
tables themselves.  This allows low-level code such as the relcache to
recognize that these tables are indeed temporary, which enables various
optimizations such as not WAL-logging changes and using local rather than
shared buffers for access.  Aside from obvious performance benefits, this
provides a solution to bug #3483, in which other backends unexpectedly held
open file references to temporary tables.  The scheme preserves the property
that TOAST tables are not in any schema that's normally in the search path,
so they don't conflict with user table names.

initdb forced because of changes in system view definitions.
This commit is contained in:
Tom Lane
2007-07-25 22:16:18 +00:00
parent fdb5b69e9c
commit 82eed4dba2
11 changed files with 148 additions and 56 deletions

View File

@ -4,7 +4,7 @@
*
* Originally by
* B. Palmer, bpalmer@crimelabs.net 1-17-2001
* $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.31 2007/07/15 22:54:20 tgl Exp $
* $PostgreSQL: pgsql/contrib/oid2name/oid2name.c,v 1.32 2007/07/25 22:16:17 tgl Exp $
*/
#include "postgres_fe.h"
@ -411,7 +411,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts)
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace "
" LEFT JOIN pg_catalog.pg_database d ON d.datname = current_database(),"
" pg_catalog.pg_tablespace t "
"WHERE relkind IN ('r'%s) AND "
"WHERE relkind IN ('r'%s%s) AND "
" %s"
" t.oid = CASE"
" WHEN reltablespace <> 0 THEN reltablespace"
@ -419,8 +419,9 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts)
" END "
"ORDER BY relname",
opts->extended ? addfields : "",
opts->indexes ? ", 'i', 'S', 't'" : "",
opts->systables ? "" : "n.nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema') AND");
opts->indexes ? ", 'i', 'S'" : "",
opts->systables ? ", 't'" : "",
opts->systables ? "" : "n.nspname NOT IN ('pg_catalog', 'information_schema') AND n.nspname !~ '^pg_toast' AND");
sql_exec(conn, todo, opts->quiet);
}