Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWg5O-0005ID-Jz for pgsql-bugs@arkaria.postgresql.org; Sat, 02 Oct 2021 14:33:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mWg5N-0002p0-Ho for pgsql-bugs@arkaria.postgresql.org; Sat, 02 Oct 2021 14:33:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWg5M-0002oE-1f for pgsql-bugs@lists.postgresql.org; Sat, 02 Oct 2021 14:33:57 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWg5I-00014b-WD for pgsql-bugs@lists.postgresql.org; Sat, 02 Oct 2021 14:33:55 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4BC325C0089; Sat, 2 Oct 2021 10:33:51 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute1.internal (MEProxy); Sat, 02 Oct 2021 10:33:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm2; bh=7SfvdooGNwgAQJ9D1D8azwpqFBKvP3A 8B/q9TwGRTlw=; b=bwIPOI4/Y9NH80AO2f14ZxC+HqR7mehxvAqO0AJoaT/7Zzt /ioesIwGwHjLUdkBDbOvjM1nzJaj8VuDPtfktHBBJLwZPAVtiA8fFMeR8JWA0pYB pJy1NFihKAhwIL21ZA3jHBz1bmnYB5xt9YRQzP0EnXXnRUT7fyX2tVktnx11Dyoq jtw2jgBa+W6fIqgIcbSfvqbZg/IRKKKbm9/zlxD8Zi0Q9a1RPgYOpf5pFr7PE2L3 A9SvHqfbJLriYP00OudwPBxZaHg47YEnqJwF84FB4OJT2o5s485o46QCz1q7XVTm mScL2+KTz9I9kg114/3JZkhLzRxk3Bff8iZ0WWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=7Sfvdo oGNwgAQJ9D1D8azwpqFBKvP3A8B/q9TwGRTlw=; b=N5CYmOzsUaUl7QyGBJsMjy eeVoh7UXXdxQVKnyoD8L4SbPMS6Neb3ioK7ob8QJxmFDgitxJ5LWGqenoTaHVDVE 9ufIkYMp9UOJSbw8qS+hL8gjxPmULqquXgJWcXVhQrgnd/VSaTTyfD8omeWw91MB yz2k0IpaU4ybG8uICiflRh975ym7H4VG8WFuxrg3UhFGJIYVYgIFKjoa5mnzYVqM eNBF+TExb1tcO1s1TYoZtJF7s1lBqG+iZNMFXq6V4CPDFUOOrjDUiBrUsmIoxjmk HFpOYXqbOXLk5uQqINH9yfGhAM8DAFxwHC4y+SL+oYMU2VWoH8+DWyofwLvoS1vg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekkedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerreejnecuhfhrohhmpedfgfhulhgvrhcuvfgrvhgvihhrrgdfuceovghulhgvrhes vghulhgvrhhtohdrtghomheqnecuggftrfgrthhtvghrnhepieeiheeffeehueehleelff efgfetjeelieevieekieekleffgeffuedtieegledtnecuffhomhgrihhnpehpohhsthhg rhgvshhqlhdrohhrghdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgvrhht ohdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D388D51C0060; Sat, 2 Oct 2021 10:33:50 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1322-g921842b88a-fm-20210929.001-g921842b8 Mime-Version: 1.0 Message-Id: In-Reply-To: <17211-838c26a1bc30a9db@postgresql.org> References: <17211-838c26a1bc30a9db@postgresql.org> Date: Sat, 02 Oct 2021 11:33:00 -0300 From: "Euler Taveira" To: gatekeeper.mail@gmail.com, pgsql-bugs@lists.postgresql.org Subject: =?UTF-8?Q?Re:_BUG_#17211:_Partitioned_index_partition_does_not_inherit_t?= =?UTF-8?Q?able_partition_tablespace?= Content-Type: multipart/alternative; boundary=4370386d173a487db3c19ac9ff886ad3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --4370386d173a487db3c19ac9ff886ad3 Content-Type: text/plain On Fri, Oct 1, 2021, at 3:07 PM, PG Bug reporting form wrote: > Suppose we have 2 tablespaces: > pg_default (which is slow) > fast > > We also have a partitioned table: > create table a (id serial not null, b int not null primary key, c int not > null, d int) partition by hash (b); > > and 2 partitions: > create table a_1 partition of a for values with (modulus 2, remainder 0); > create table a_2 partition of a for values with (modulus 2, remainder 1) > tablespace fast; > > This successfully allocates table a_2 pages within the 'fast' tablespace; > but this fails to allocate a_2_pkey primary key index there too and the > result is the index is allocated on tablespace oid(0) which means pg_default > I guess, at least the corresponding relfilenode is allocated within the > pg_default tablespace. That's how it was designed. TABLESPACE clause at the end of CREATE TABLE set the tablespace only for the table. The index is stored based on the default_tablespace [1] value. Since there is no way to specify USING INDEX TABLESPACE for partitions, you should set default_tablespace to achieve what you want. CREATE TABLE a ( id serial NOT NULL, b int NOT NULL PRIMARY KEY, c int NOT NULL, d int ) PARTITION BY hash (b); CREATE TABLE a_1 PARTITION OF a FOR VALUES WITH (MODULUS 3, REMAINDER 0); SET default_tablespace TO 'fast'; -- the TABLESPACE clause is not required -- table -> fast ; index -> fast CREATE TABLE a_2 PARTITION OF a FOR VALUES WITH (MODULUS 3, REMAINDER 1) TABLESPACE fast; -- table -> tablespace slow ; index -> tablespace fast CREATE TABLE a_3 PARTITION OF a FOR VALUES WITH (MODULUS 3, REMAINDER 2) TABLESPACE slow; RESET default_tablespace; [1] https://www.postgresql.org/docs/14/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-STATEMENT -- Euler Taveira EDB https://www.enterprisedb.com/ --4370386d173a487db3c19ac9ff886ad3 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Fri, Oct 1, = 2021, at 3:07 PM, PG Bug reporting form wrote:
Suppose we have 2 tablespaces:
pg_default (which is slow)
fast
We also have a partitioned table:
create table= a (id serial not null, b int not null primary key, c int not
<= div>null, d int) partition by hash (b);

and= 2 partitions:
create table a_1 partition of a for values = with (modulus 2, remainder 0);
create table a_2 partition = of a for values with (modulus 2, remainder 1)
tablespace f= ast;

This successfully allocates table a_2 = pages within the 'fast' tablespace;
but this fails to allo= cate a_2_pkey primary key index there too and the
result i= s the index is allocated on tablespace oid(0) which means pg_default
=
I guess, at least the corresponding relfilenode is allocated = within the
pg_default tablespace.
That's how it was designed. TABLESPACE clause at the end of CREATE TA= BLE set
the tablespace only for the table. The index is st= ored based on the
default_tablespace [1] value.
<= div>
Since there is no way to specify USING INDEX TABLESPA= CE for partitions, you
should set default_tablespace to ac= hieve what you want.

CREATE TABLE a (
  id serial NOT NULL,
  b int NOT NULL = PRIMARY KEY,
  c int NOT NULL,
  d= int
) PARTITION BY hash (b);

CREATE TABLE a_1 PARTITION OF a
FOR VALUES WITH (MODULUS = 3, REMAINDER 0);

SET default_tablespace TO = 'fast';

-- the TABLESPACE clause is not req= uired
-- table -> fast ; index -> fast
CREATE TABLE a_2 PARTITION OF a
FOR VALUES WITH (MODULUS = 3, REMAINDER 1) TABLESPACE fast;

-- table -= > tablespace slow ; index -> tablespace fast
CREATE = TABLE a_3 PARTITION OF a
FOR VALUES WITH (MODULUS 3, REMAI= NDER 2) TABLESPACE slow;

RESET default_tabl= espace;



--
Euler Taveira

--4370386d173a487db3c19ac9ff886ad3--