Re: Cluster table based on grand parent? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Cluster table based on grand parent?
Date
Msg-id 28cfc94c-f778-548d-1159-e33627e44eec@aklaver.com
Whole thread Raw
In response to Cluster table based on grand parent?  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: Cluster table based on grand parent?
List 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.klaver@aklaver.com




pgsql-general by date:

Previous
From: Sebastien Flaesch
Date:
Subject: Re: Using CTID system column as a "temporary" primary key
Next
From: "Peter J. Holzer"
Date:
Subject: Patroni, slots, and expiring WALs