From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Cluster table based on grand parent? |
Date: | 2023-03-28 14:26:47 |
Message-ID: | 28cfc94c-f778-548d-1159-e33627e44eec@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/28/23 06:17, Dominique Devienne wrote:
> Hi again,
>
> Thanks for any insights. --DD
>
> PS: At this point, I don't even know how much cluster affects performance.
> But because it can affect the schema structure (by denormalizing),
> i'd rather know early.
You will need to explain to me how it denormalizes? It reorders rows by
index definition and does not maintain that order over updates and inserts.
>
> [1]: https://www.postgresql.org/docs/current/sql-cluster.html
> <https://www.postgresql.org/docs/current/sql-cluster.html>
>
> ```
> dd=> create table parent (id int generated always as identity primary
> key, name text not null unique);
> CREATE TABLE
>
> dd=> create table child (id int generated always as identity primary
> key, parent int not null references parent(id) on delete cascade, name
> text not null, unique(parent, name));
> CREATE TABLE
>
> dd=> create table grandchild (id int generated always as identity
> primary key, parent int not null references child(id) on delete cascade,
> name text not null, unique(parent, name));
> CREATE TABLE
> ```
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan S. Katz | 2023-03-28 14:51:50 | Re: Support logical replication of DDLs |
Previous Message | Sebastien Flaesch | 2023-03-28 14:23:06 | Re: Using CTID system column as a "temporary" primary key |