Re: tablespaces for temporary files

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tablespaces for temporary files
Date: 2004-11-01 01:35:34
Message-ID: 1099272934.31449.78.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 2004-10-30 at 00:50, Tom Lane wrote:
> (1) What are the protection requirements for this variable?

I think it can be USERSET -- most commands let the user specify a
tablespace explicitly, and this is basically just another way of doing
that. The user executing the query will need CREATE privileges on the
tablespace they end up writing to.

> (2) I don't think that "undefined" is a particularly good concept for
> GUC variables. Particularly not ones that you are envisioning setting
> from multiple places.

Hmm, ok. How about a token like "$database" that expands to the
tablespace of the current database?

> (3) I don't like the idea that a catalog lookup will be necessary before
> we can create or access temp files. It would be quite unacceptable from
> a modularity standpoint to have the low-level routines that currently
> determine temp file paths do catalog accesses.

I don't agree it is "unacceptable", but it isn't ideal, granted.

> On the whole I'm unconvinced that this is worth the trouble. One of the
> reasons for allowing people to move databases around is to determine
> where their temp files go.

I think this needlessly limits the flexibility of the system. Once
you've created a database and added a bunch of tables to it (in the DB's
tablespace), is there an easy way to change the tablespace used for
temporary files? What if the DBA has placed the database in a relatively
slow tablespace because that is suitable most of the time, but needs to
quickly execute a large OLAP query that consumes a lot of temporary
space? What if it makes sense at a particular installation for different
users to use different tablespaces for their temporary files?

I just think that always using the database's tablespace for temporary
files needlessly conflates two distinct concepts.

> Also, it's always been possible for people
> to change the pgsql_tmp subdirectory into a symlink.

This is a pain for the DBA, as you mention; it requires shutting down
the database; and it is fragile to begin with because the "pgsql_tmp"
directory is created on demand.

-Neil

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-01 02:18:13 Re: Using ALTER TABLESPACE in pg_dump
Previous Message Neil Conway 2004-11-01 01:27:04 Re: make check error on -HEAD