How to union all tables in a schema into one whole table?
How to union all tables in a schema into one whole table?
От:
Shaozhong SHI <shishaozhong@gmail.com>
Дата:
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
Re: How to union all tables in a schema into one whole table?
От:
Frank Gard <frank.von.postgresql.org@familie-gard.de>
Дата:
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