From: Chao Li <li.evan.chao@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Álvaro Herrera <alvherre@kurilemu.de>
Cc: pgsql-hackers@postgresql.org
Cc: euler@eulerto.com
Cc: andres@anarazel.de
Subject: Re: split tablecmds.c
Date: Tue, 2 Dec 2025 07:29:49 +0800
Message-ID: <E39DF820-696B-4A66-8AA7-2DC34A9C40DD@gmail.com> (raw)
In-Reply-To: <aS4aGQp3WXzFoCVz@nathan>
References: <202512011754.hpa4uqkqtq4f@alvherre.pgsql>
<213385.1764615541@sss.pgh.pa.us>
<aS4aGQp3WXzFoCVz@nathan>
> On Dec 2, 2025, at 06:43, Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Mon, Dec 01, 2025 at 01:59:01PM -0500, Tom Lane wrote:
>> I didn't do any math about it, but that's got to be a far faster rate
>> of expansion than the overall PG code base. Maybe partitioning is
>> largely to blame? Perhaps analyzing what functionality got added
>> here in the past dozen or so years would yield some ideas for how to
>> split it.
>>
>> +1 for a split, if we can figure out a good plan.
>
> I tried to move the partitioning-related code to a new file, and it wasn't
> too bad. Note that there are a couple of internal-to-tablecmds.c things
> that need to be exported. Besides that, the attached patch is still pretty
> rough, and I'm not sure I correctly placed the line in the sand when
> determining what stays and what goes, but this at least shows the general
> shape of what's needed. (BTW git was generating an atrocious diff for
> tablecmds.c. You might need to set the diff algorithm to "minimal" if you
> are similarly affected.)
>
> src/backend/commands/Makefile | 1 +
> src/backend/commands/meson.build | 1 +
> src/backend/commands/partcmds.c | 3377 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> src/backend/commands/tablecmds.c | 3456 +--------------------------------------------------------------------------------------------
> src/backend/partitioning/partbounds.c | 1 +
> src/include/commands/partcmds.h | 53 ++
> src/include/commands/tablecmds.h | 134 +++-
> 7 files changed, 3575 insertions(+), 3448 deletions(-)
>
> --
> nathan
> <v1-0001-move-partition-code-in-tablecmds.c-to-new-file.patch>
I am just thinking if tablecmds deserves a subfolder given the large code size. If we just split the file into multiple and still place them under src/backend/commands, then it would be not easy to identify alter-table related code.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: li.evan.chao@gmail.com, nathandbossart@gmail.com, tgl@sss.pgh.pa.us, alvherre@kurilemu.de, euler@eulerto.com, andres@anarazel.de
Subject: Re: split tablecmds.c
In-Reply-To: <E39DF820-696B-4A66-8AA7-2DC34A9C40DD@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox