Search Postgresql Archives

Re: Cluster table based on grand parent?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 28, 2023 at 6:06 PM Ron <ronljohnsonjr@xxxxxxxxx> wrote:
You can only get from parent to grandchild via child.id to grandchild.parent, so why not cluster grandchild on grandchild.parent?

Hi. I don't understand your question. Yes, of course, if I want all grand-children of a given parent, I'll do for example:

select p.id, c.id, c.name, gc.*
  from  grandchild gc
   join child c on gc.parent = c.id
   join parent p on c.parent = p.id
where p.name = $1

But w/o clustering on a denormalized grandchild.grandparent FK column, as Peter showed,
and cluster only on grandchild.parent, that's not going to access a mostly continuous range
of pages to fetch those all grandchild rows for that one parent. But probably 10 to 50 "row-clusters",
given the fan-out I mentioned earlier at the child-table level. Or am I missing something?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux