public inbox for [email protected]  
help / color / mirror / Atom feed
How to union all tables in a schema into one whole table?
3+ messages / 3 participants
[nested] [flat]

* How to union all tables in a schema into one whole table?
@ 2022-10-13 17:02  Shaozhong SHI <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Shaozhong SHI @ 2022-10-13 17:02 UTC (permalink / raw)
  To: pgsql-sql <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Aw: How to union all tables in a schema into one whole table?
@ 2022-10-13 17:06  Karsten Hilbert <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Karsten Hilbert @ 2022-10-13 17:06 UTC (permalink / raw)
  To: Shaozhong SHI <[email protected]>; +Cc: pgsql-sql <[email protected]>

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>You can use a view, a select with union, or appropriate DDL.</div>

<div>&nbsp;</div>

<div>Karsten</div>

<div>&nbsp;
<div>&nbsp;
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b>&nbsp;Donnerstag, 13. Oktober 2022 um 19:02 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Shaozhong SHI&quot; &lt;[email protected]&gt;<br/>
<b>An:</b>&nbsp;&quot;pgsql-sql&quot; &lt;[email protected]&gt;<br/>
<b>Betreff:</b>&nbsp;How to union all tables in a schema into one whole table?</div>

<div name="quoted-content">
<div>A series of table like tttt.table1, ttt.table2 has been generated in the schema ttt.
<div>&nbsp;</div>

<div>How best to union all these tables into a whole one?</div>

<div>&nbsp;</div>

<div>They have the exact same columns.</div>

<div>&nbsp;</div>

<div>Regards,</div>

<div>&nbsp;</div>

<div>David</div>
</div>
</div>
</div>
</div>
</div></div></body></html>





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to union all tables in a schema into one whole table?
@ 2022-10-13 17:17  Frank Gard <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Frank Gard @ 2022-10-13 17:17 UTC (permalink / raw)
  To: [email protected]

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-10-13 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 17:02 How to union all tables in a schema into one whole table? Shaozhong SHI <[email protected]>
2022-10-13 17:06 ` Aw: How to union all tables in a schema into one whole table? Karsten Hilbert <[email protected]>
2022-10-13 17:17 ` Frank Gard <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox