Re: How to union all tables in a schema into one whole table? - Mailing list pgsql-sql

From Frank Gard
Subject Re: How to union all tables in a schema into one whole table?
Date
Msg-id 06e0486c-341c-a6b8-e076-5e704179714d@familie-gard.de
Whole thread Raw
In response to How to union all tables in a schema into one whole table?  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-sql

Hi,

I don't know much about your tables, but maybe (i.e. when they comply with the requirements) you could use table partitioning. Create a partitioned table and use "ALTER TABLE … ATTACH PARTITION …" to bring them all together.

See https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE and the ALTER TABLE statement for details.

Cheers,
Frank.

Am 13.10.22 um 19:02 schrieb Shaozhong SHI:
A series of table like tttt.table1, ttt.table2 has been generated in the schema ttt.

How best to union all these tables into a whole one?

They have the exact same columns.

Regards,

David

pgsql-sql by date:

Previous
From: Shaozhong SHI
Date:
Subject: How to union all tables in a schema into one whole table?
Next
From: Shaozhong SHI
Date:
Subject: Append a list of tables to an empty table to form a whole table