Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wA3m2-0021f6-0p for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 10:35:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wA3m0-00GmAj-2E for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 10:35:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wA3m0-00GmAV-0V for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 10:35:08 +0000 Received: from mail-yx1-xb131.google.com ([2607:f8b0:4864:20::b131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wA3ly-0000000114q-2F12 for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 10:35:07 +0000 Received: by mail-yx1-xb131.google.com with SMTP id 956f58d0204a3-650775f427eso1232158d50.2 for ; Tue, 07 Apr 2026 03:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775558106; cv=none; d=google.com; s=arc-20240605; b=SJ6eh+6CoH1FDf0/kH3ECq7GjTuSAzKQ55urij+jOAcMrBn9xd8FmDrMpDKU9PydMt /nTn46N8dZf9uUIxVP8vDTYUdx2T8In9qZ7annkpwY6iuyQk1uWnPOMYPSpoyAzijcvr F9BSPE2OF6tt7S4yGBkCU5/9V+utBqyAOA9t1VJzXleVc/cTkeAe5ziM1ww63qBXCYbi k4TuEDzXLq2AVYNyl9N90H8UdjgA2GasqJnzxKho02RapIYVhZkqb6URSgj//Nf9i0Oj coyOFmkqtZYKwCwmoDDTb/WXsBy1/acP82UZSYNXnzQL1aUPyjxtaBwReL82zNVCQXQW GOqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=gzTEcK+hjGSd+Z50uyGgCbtfaBr/FTrPYLMc3C0ln/g=; fh=UI8LZqL19m5RCi/QBNhHEO50UFkWtx4gK2AFxDhHnRI=; b=MYnUCgdTVf1ms/7rH+ZfYpo0WgLWLFUe0cgORz8vZSzI3YxjhSuSEW3/rTnMF2fmsu f8obznWYhLG8iDX7DArMOW/p7eOIyWABGyHfbgJ8amD/WkP3voFvHaFahRGMl6h6N78k otb3OtQzGfIiaylBgJe0zzvbRtDgQhzEdsdNyKmgbkt3u4HNyB20zGaV1XePWvdt28qX eDzSzGSNI5h79HKps13Xn3ujJLFznYeXB4auMU19s8lBQOhDEkK1rf1+Fr8fhBdcGM1J 9iiGzXdm0ZAgja9Y2Y2MldUt2B4oTaY9DDr7UkFE2llU9JNvFuPRr0uHS4PCstlVDfJR 9gAQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775558106; x=1776162906; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gzTEcK+hjGSd+Z50uyGgCbtfaBr/FTrPYLMc3C0ln/g=; b=HZvHVIe5sdrOIU+065TYWXl7Mf9/+/poJ+O2SRSmuupW0yVEWPaIX9J8Y7tt8K3ZUL Z6MYMzqZQVGN/+cTjIRzvw8aZaOixkIVG2UeQ2XbjFTRna4CvtMkN4RZfdkqVg28qWzu Io+8fs89R9iVmofPLzpUNqMalnfYENrCpTa5Fa1j7M/X6/7AZY9pk1Ory5Y0dtkMNTJN jvB6z3XrlgMctLpdfx/1jyE17zhvkKVXpefoUJoqr5lhIGLqvzffHStv7nIB/gthASW5 9kEptGpP5v0nxTN//dSZO/77gQYpHMLnQrX8U/yczMDga7mVHoVSXquuqO0Vp75iVuLF /FIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775558106; x=1776162906; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gzTEcK+hjGSd+Z50uyGgCbtfaBr/FTrPYLMc3C0ln/g=; b=QL1sO+m8ikRWT+v6526zF3X2/9Zzans1dVOwJbmE0zo8CcxkaETqd0DbAk8Lfu1YBP CgsluFlwGBrVkaLi+3iqXznUnBYewA0isw6kICxgS2PfamyNCNwdWAcPFzVGYAFfBAzJ stIMN/5uMv04Oowu4+oDnlz6rDDZlkAbdVGfk40eLzvLT2lo4q4Z2U06r2Fie2s4VTL5 9svr+rN10uVi96Rf3HZtDAJ2yV3BgL+LwMutPnFRjFrR/7wH1DJAzauL3PJFqmZx5ybd VDLD503oLnTEqQoGHvrYvNoSf4GrkUWuCWSciQ2+rRDm6Uz+sNhvrBwh/t7kMvgQ92bN VRBQ== X-Forwarded-Encrypted: i=1; AJvYcCXyJJydiTqoDe1mEPqHzcrwjUcNtHML29xPkFuNzmR3QdSEHI8FHX/Y5c6Wh7TW94UHsm//FvVqng60/034@lists.postgresql.org X-Gm-Message-State: AOJu0YzJNoPeam/EDDW4o9r0dPfTGuvZoRcXjY+R4zgTVstp2rOCOm// kYHWg5Ocgug1Igysc9qJpdif0Il/R8hfgtl4ssjwqihrehlo8Yal75ok0HEimOgv7YYTeXaP4O+ t6UInPoEUQAMWzOs4F2Fo0xfq134kTiw= X-Gm-Gg: AeBDietCN1ULG/jXzNhVDlbVzxeLOM1xXWTFgQsBdmB3nLpvxV8Z8U/PPetOl00uVfV CsVk2xnk6TTGxZQsmuCIrk8boNuhxRJmTunBm1zUmUEfWfUqm/cpTr4PsaZ3w21UQ/qSOCJmGoM gWF2rbtEN+PazmhchB77om+DjsI0+zv0+5jWXhG4xqaosQkNkyrBmPgfGqe+8HJ1F9nR099PNC9 K3uX0+i0Jn1NSbHvcCtLUcPanWjfgT0/z3VzNF7VCfKWetgUOpF3BJRiGpmdWC8AJILq1+c+F8K NocXQ5unwm05YR1V1CF2DiFyGxhCJ00SSPiIpQioskpV/hgiiQ== X-Received: by 2002:a05:690e:158b:20b0:64e:de26:976b with SMTP id 956f58d0204a3-65048743a45mr11636419d50.25.1775558105717; Tue, 07 Apr 2026 03:35:05 -0700 (PDT) MIME-Version: 1.0 References: <2119849.1773605379@sss.pgh.pa.us> In-Reply-To: From: JoongHyuk Shin Date: Tue, 7 Apr 2026 19:34:54 +0900 X-Gm-Features: AQROBzAC_woZzt50QLyTaTaluDC2Z2_II1D5UVbf_lBJPGigFT-ASwI8bekQmdQ Message-ID: Subject: Re: Inconsistency in owner assignment between INDEX and STATISTICS To: Tom Lane Cc: Amit Khandekar , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000002b5fe0064edc5664" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002b5fe0064edc5664 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable One related thing I noticed. Unlike CREATE INDEX, CREATE STATISTICS on a partitioned table does not propagate to child partitions. Is that intentional, or simply not implemented yet? In practice, if you create statistics on a partitioned parent and then EXPLAIN a WHERE query, the planner doesn't use the stats because after partition pruning it looks at the child's statistics, where none exist. You have to create statistics on each child explicitly to get the benefit. If the answer is "create stats per partition yourself", that's fine. Just wanted to confirm whether this is by design. On Mon, Mar 16, 2026 at 10:15=E2=80=AFAM Shin Berg wr= ote: > Thank you for the additional context, Tom. That makes the design intent > much clearer. > Cross-table statistics, if realized, would be a significant improvement > for join cardinality estimation; looking forward to seeing that develop. > > Regards, > Joshua Shin > > On Mon, Mar 16, 2026 at 5:09=E2=80=AFAM Tom Lane wrot= e: > >> Shin Berg writes: >> > Thank you for the detailed feedback, Amit. >> > You're right on both points. I had been comparing STATISTICS against >> INDEX >> > and treating the difference as an inconsistency, but as you point out, >> > INDEX ownership is special =E2=80=94 it's tied to the table and intent= ionally >> not >> > user-adjustable. STATISTICS follows the same ownership model as VIEW >> (the >> > creator becomes the owner), which is consistent and by design. >> >> One point that was not mentioned is that while indexes are necessarily >> tied to a single table, statistics objects might not always be. The >> long-term hope is to allow statistics on cross-table combinations of >> columns, which is why the syntax was intentionally set up to look like >> SELECT. So, just like views, it's reasonable to give them independent >> ownership. >> >> regards, tom lane >> > --0000000000002b5fe0064edc5664 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
One related thing I noticed.
Unlike CREATE INDEX, CREAT= E STATISTICS on a partitioned table does not propagate to child partitions.=
Is that intentional, or simply not implemented yet?

In practice= , if you create statistics on a partitioned parent and then EXPLAIN a WHERE= query,
the planner doesn't use the stats because after partition p= runing it looks at the child's statistics,
where none exist. You ha= ve to create statistics on each child explicitly to get the benefit.
If the answer is "create stats per partition yourself", that'= ;s fine.
Just wanted to confirm whether this is by design.

=
On Mon, Mar 16, 2026 at 10:15=E2=80=AFAM Shin Berg <sjh910805@gmail.com> wrote:
Thank y= ou for the additional context, Tom. That makes the design intent much clear= er.
Cross-table statistics, if realized, would be a significant improve= ment for join cardinality estimation; looking forward to seeing that develo= p.

Regards,
Joshua Shin

On Mon, Mar 16, 2026 at 5:09=E2=80=AFAM To= m Lane <tgl@sss.p= gh.pa.us> wrote:
Shin Berg <sjh910805@gmail.com> writes:
> Thank you for the detailed feedback, Amit.
> You're right on both points. I had been comparing STATISTICS again= st INDEX
> and treating the difference as an inconsistency, but as you point out,=
> INDEX ownership is special =E2=80=94 it's tied to the table and in= tentionally not
> user-adjustable. STATISTICS follows the same ownership model as VIEW (= the
> creator becomes the owner), which is consistent and by design.

One point that was not mentioned is that while indexes are necessarily
tied to a single table, statistics objects might not always be.=C2=A0 The long-term hope is to allow statistics on cross-table combinations of
columns, which is why the syntax was intentionally set up to look like
SELECT.=C2=A0 So, just like views, it's reasonable to give them indepen= dent
ownership.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 regards, tom lane
--0000000000002b5fe0064edc5664--