Re: Plans for partitioning of inheriting tables
От | Adrian Klaver |
---|---|
Тема | Re: Plans for partitioning of inheriting tables |
Дата | |
Msg-id | ce5f42dd-9513-479a-b64f-2d05b0d22135@aklaver.com обсуждение исходный текст |
Ответ на | Re: Plans for partitioning of inheriting tables (Thiemo Kellner <thiemo@gelassene-pferde.biz>) |
Ответы |
Re: Plans for partitioning of inheriting tables
|
Список | pgsql-general |
On 11/1/24 13:47, Thiemo Kellner wrote: > It looks to me basically to be a "create table A as select * from B where false". No it more capable then that. CREATE TABLE <some_tbl> AS <some_other_tbl> is bare bones, you get the column names, types and data(or not) and that is it. CREATE TABLE <some_tbl> LIKE <some_other_tbl> has like_option which allows to transfer over more attributes of the table, for example defaults, constraints, indexes, etc. See https://www.postgresql.org/docs/current/sql-createtable.html LIKE source_table [ like_option ... ] > > 01.11.2024 20:38:15 Adrian Klaver <adrian.klaver@aklaver.com>: > >> On 11/1/24 12:16, thiemo@gelassene-pferde.biz wrote: >>> Thanks, I shall have a look into it. I was under the assumption the the create table like would create no more than astructural copy. >> >> Not sure what you mean by structural copy, but the table created by CREATE TABLE LIKE will not have any association withthe table it was created from. >> >> https://www.postgresql.org/docs/current/sql-createtable.html >> >> "Unlike INHERITS, the new table and original table are completely decoupled after creation is complete. Changes to theoriginal table will not be applied to the new table, and it is not possible to include data of the new table in scansof the original table." >> >>> Torsten Förtsch <tfoertsch123@gmail.com <mailto:tfoertsch123@gmail.com>> escribió: >>> Thiemo, >>>> it looks to me like you are using inheritance just to make sure your SOURCES and TOPO_FILES tables have some commoncolumns. If you are not actually querying the TEMPLATE_TECH table and expect to see all the rows from the other 2 tablesin that one table combined, then you could use CREATE TABLE (LIKE ...) instead of inheritance. That way your "child"tables would become normal tables and you could use declarative partitioning on them. >>>> Even if you are querying the TEMPLATE_TECH table, you could still do that by turning the TEMPLATE_TECH table into aview which performs a UNION ALL over the other tables. >>> >> >> -- >> Adrian Klaver >> adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: