Re: Cluster table based on grand parent?
От | Ron |
---|---|
Тема | Re: Cluster table based on grand parent? |
Дата | |
Msg-id | 334a4103-6f8a-4942-c153-ca0692352d79@gmail.com обсуждение исходный текст |
Ответ на | Re: Cluster table based on grand parent? (Dominique Devienne <ddevienne@gmail.com>) |
Список | pgsql-general |
On 3/28/23 11:28, Dominique Devienne wrote:
No, you're not missing something. If you want to go directly from grandparent to grandchild, then you need to put grandparent_id in the grandchild table.
Rob Sargent is right, too, though: practically it might not make a difference. You've got to test.
On Tue, Mar 28, 2023 at 6:06 PM Ron <ronljohnsonjr@gmail.com> 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:from grandchild gcjoin child c on gc.parent = c.idjoin parent p on c.parent = p.idwhere p.name = $1But 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 rangeof 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?
No, you're not missing something. If you want to go directly from grandparent to grandchild, then you need to put grandparent_id in the grandchild table.
Rob Sargent is right, too, though: practically it might not make a difference. You've got to test.
--
Born in Arizona, moved to Babylonia.
Born in Arizona, moved to Babylonia.
В списке pgsql-general по дате отправления: