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 1wZsk2-001Mo3-22 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 16:03:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZsk1-006o7X-1X for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2026 16:03:49 +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 1wZsk1-006o7P-0G for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2026 16:03:49 +0000 Received: from mail-dl1-x122a.google.com ([2607:f8b0:4864:20::122a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZsjz-00000000pT4-3eGv for pgsql-hackers@postgresql.org; Wed, 17 Jun 2026 16:03:48 +0000 Received: by mail-dl1-x122a.google.com with SMTP id a92af1059eb24-1363fe80fe8so8542258c88.0 for ; Wed, 17 Jun 2026 09:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781712226; cv=none; d=google.com; s=arc-20240605; b=TocROmRIF/pHSPZ/UopzdZ1engZ+IRaldV8Y8mH2ojnXYyPRHOZYDMzaqkPFmuw9E2 eP/synUNbAK/a95KcUX6qW6MHRy0PK9VxX3VgqSCCs8oMOY0gKIwz+jOIy6vGYjz1Hx2 93Psm6GG1egKHCnAhNx1DJMQmQTf3K9xSI5lI92IuI58ilFI1Fu9tR22f2FB16of2MBv kij+Q4AqleSncwciUDGMVtTgxT0xmHTMt6o1yJ1SY93AtNpDz6buZAK9Pf8NyPaDMUzB lFM1LeMMCOLrr3D6bsiFXqiDyjq99DB5pvZZn+8wZBu0nu/pN3wcdc7BxYEOHJISi6f9 wzqA== 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=bLZ9UFRBzHQ2p8dOEajsuGx8L0JZ80fAwXGR+JMImSk=; fh=w2cpahXlyPUgwJkOXGpQGm3iawPrYCokT25/1HSccOA=; b=ShKkzUxjFgPMb/vqzzZRuMDG/LOdMMZBzCQO+cQx8Pcb0rvlrLdZsiUjJe99Y7GEnU q3BUHA5z+WvJ7j8vwLH5V72checlN31oNtIpVhIZ594Lr9S+8erV2neZlVQHlIZbHx8x lDOqG3mq91mlEfXe7gIn3PAVexgGD3WbkCYVTi5mQmLpIf83f3fWAs+ts67W4XSIlmMa nok7P1vdv97k6twO91PU2hIG+pOjtMSP0fulPLiSGoBE+yl7v1KIdFhkDOoYL1kzgkc4 Xd7GYG/aiQmq9xRhQEpW7YIqK5+lIUPKXjosYaI0xgpJnuDRkcAo0SYP/TYPA5SDYOnT EwLg==; darn=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=1781712226; x=1782317026; darn=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=bLZ9UFRBzHQ2p8dOEajsuGx8L0JZ80fAwXGR+JMImSk=; b=r45snM2tfGYO4q7Qe+T87NjkIs0tH7DnrYasGz3SqfWvcfj8D8z+HLTVqZeN1qVHOe WXW5AaoaH1H+AzHLCBZIJiThfrC4jZimMIcME5QgB7EublyKT986dKcvIzK6F8n7zbVR ssXWAj1/hiGR76g4nwy6Fgn9pk9Kqvfm0/lndlD37ebGPFCIoR0LhhnDXOuScOuA2iCf i6IV3UKeJxDVAAQ+TEthHk4GzCQ2jcM1i8m1LQMmI0VvdUAhQFOaPoBDUySxxhvzucqM +QwOiDqP4otdPmKKmRixVdPROThKa3I+jWoZnIQ4m2ydPy7hVg+S59+W/CB9MT1mUD3V Yf4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781712226; x=1782317026; 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=bLZ9UFRBzHQ2p8dOEajsuGx8L0JZ80fAwXGR+JMImSk=; b=TxFL9tO1QoudwFEDOe5piMZ06YgYCGAByjlRzfNmnsjKIyufROJSU1Y8xQeHAhiZip dArq9lj0bMFasM3NEaa6Y92h6uPHWZCRkauad1vOuUiWjUV7/6rTvgxIDzlku9KtunBw 5y4nbTZxU5psHVrw1v/BvX/R0kYn8rwTszJ2o34vUJS/BWQdQMtyVHQBBPnaxRICWUS9 V6b80n2IOQnZH5BG/XfMRRs17dbpr0dpBoY+JuUYltBHs5XE1A05f9gshR/1ZRfuxnCL 7nnN03vGhOOTrmhv1qiIQwVsk1D2swKO107hl4aN6MzwgSsSIP5mGS6qku19SeV80ATZ Yq8w== X-Forwarded-Encrypted: i=1; AFNElJ95px4vV3wR3VPS66ZVuS2uKsHzfPmrO7QQWf07zGWK72rGOoo52DwXZ0VuadJfJg0IBxLuAmqUGxRW0E+u@postgresql.org X-Gm-Message-State: AOJu0Yw5NoyuYavUZjO2CtomsBAi01CgLSjzmDhnKhiWIaW4n3Fpm9lP JPb2Ux7ZMtBjowK4PUNDu0yJ4GCeKE/kkO9CHT+knVWVI/30CRTa0nfD3PI18GO9GRe5gBJoUg+ kbnDxt471Hh9pPhsVk/SnflPzsX4EHFWm/Q== X-Gm-Gg: Acq92OFDFUCNKf+DjjxWRfKz+yOuSbthqbpRDDB8/q+Di6qbP1pOe4fCTHejHun5/Wd maEegBldiQin+BWx3GyKyJhUDPrkYlDiR0wkEnb86MH4uoznRQzfhcIdpX4myUIm0UVsSDAogOA eTi5UrUxdzPv9lkMoM1ziiQ/1lPmRHzZI8lzw2VffArwNbCl0KrDtAVWnIDZjnhNlMoHXJe3ao6 16WMtjDOJ1PQBqQryzc8mRLjPH3JVeqDw5208y1ozgfMWNCQgnRRTSVsYsrga+mgsaail8nTcvD BnMv7czPfyU/wS62LU1tWjBrjUtDDjfRjSbJT/LL8M4kte7JszbTTLh28gKLWKFN9330QsQFgHu GuRNKuNk0Sv4Y0A== X-Received: by 2002:a05:7022:e0e:b0:137:6781:7dc5 with SMTP id a92af1059eb24-1398f6cd840mr2018888c88.24.1781712226030; Wed, 17 Jun 2026 09:03:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Corey Huinker Date: Wed, 17 Jun 2026 12:03:33 -0400 X-Gm-Features: AVVi8CfRfcN-ld3ycohyQMwPsCzHltrSbkYBAQDnNOauf5VTAYtNTMxstsytgis Message-ID: Subject: Re: use of SPI by postgresImportForeignStatistics To: Robert Haas Cc: Etsuro Fujita , "pgsql-hackers@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000005316d006547534d8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005316d006547534d8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 16, 2026 at 6:57=E2=80=AFPM Robert Haas = wrote: > On Tue, Jun 16, 2026 at 6:50=E2=80=AFPM Corey Huinker > wrote: > > postgres_fdw will get slimmer for not having SPI in it. relation_stats.= c > and attribute_stats.c will have some temporary bloat until things can be > refactored. > > Whatever ends up in core can (indeed must) be reused by every FDW. So > making things simpler for the FDW and more complex for core seems > likely to be the right tradeoff in general. I had assumed we wanted a generic C API to these two functions, but if we want something that is specific to FDWs, that might change where the functions land in the header files. It's an easy change to make if we change our minds, but it would be good to know if we do or do not want something specific to FDWs. Personally, I think FDWs will be 90-95% of the usages outside of the existing SQL-defined functions, but 95% is not 100%, so I'd be inclined to leave them in a statistics/stats utils header. --0000000000005316d006547534d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Jun 16, 2026 at 6:57=E2=80=AFPM Rober= t Haas <robertmhaas@gmail.com> wrote:
On= Tue, Jun 16, 2026 at 6:50=E2=80=AFPM Corey Huinker <corey.huinker@gmail.com> w= rote:
> postgres_fdw will get slimmer for not having SPI in it. relation_stats= .c and attribute_stats.c will have some temporary bloat until things can be= refactored.

Whatever ends up in core can (indeed must) be reused by every FDW. So
making things simpler for the FDW and more complex for core seems
likely to be the right tradeoff in general.

I had assumed we wanted a generic C API to these two functions, but if we = want something that is specific to FDWs, that might change where the functi= ons land in the header files. It's an easy change to make if we change = our minds, but it would be good to know if we do or do not want something s= pecific to FDWs. Personally, I think FDWs will be 90-95% of the usages outs= ide of the existing SQL-defined functions, but 95% is not 100%, so I'd = be inclined to leave them in a statistics/stats utils header.
--0000000000005316d006547534d8--