Re: Creating index on different tablespace and its temp files

Lists: pgsql-novice
From: Marcin Mirosław <marcin(at)mejor(dot)pl>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Creating index on different tablespace and its temp files
Date: 2010-10-11 07:47:31
Message-ID: 4CB2C113.3060700@mejor.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hello!
I've got two additional tablespaces, let's call them tb_1 and tb_2.
Default tablespace for databse is tb_1, and all objects inside the one
are in tablespace tb_1.
I've start to create index with tablespace tb_2:
'
CREATE INDEX "idx.XX"
ON tableX (flow_start ASC NULLS FIRST)
WITH (FILLFACTOR=100)
TABLESPACE tb_1;
'
and i noticed that temporary files for new index are creating in tb_1
not tb_2. Let's imagine that tb_2 could be on diffrent hdd, creating
files in tb_2 should be faster because:
- there would bo no need to copy all index (after succesfull creating)
from tb_1 to tb_2
- reading data from disk is faster than reading and writting to the same hdd

I'm wondering what was the reasons to make "create index tablespace ..."
working in this way.
Thanks for reply.
[postgresql-9.0.1]

Regards,
Marcin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marcin Mirosław <marcin(at)mejor(dot)pl>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Creating index on different tablespace and its temp files
Date: 2010-10-11 13:47:30
Message-ID: 22305.1286804850@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

=?UTF-8?B?TWFyY2luIE1pcm9zxYJhdw==?= <marcin(at)mejor(dot)pl> writes:
> and i noticed that temporary files for new index are creating in tb_1
> not tb_2.

Actually they're spread semi-randomly across all available tablespaces.

IIRC there's a parameter you can set to control which tablespaces are
used for temp files, if you care.

regards, tom lane


From: Marcin Mirosław <marcin(at)mejor(dot)pl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Creating index on different tablespace and its temp files
Date: 2010-10-12 08:42:33
Message-ID: 4CB41F79.4000307@mejor.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

W dniu 11.10.2010 15:47, Tom Lane pisze:
> Actually they're spread semi-randomly across all available tablespaces.
>
> IIRC there's a parameter you can set to control which tablespaces are
> used for temp files, if you care.

I'm afraid that temporary files are only created in one tablespace, the
default for database (or the same which is choosed for table). Maybe is
this something interested for "performance side of pg"?:)
Thanks for reply and regards!
Marcin