pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chao Li <li.evan.chao@gmail.com>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: vacuumdb: add --dry-run
Date: Tue, 18 Nov 2025 11:58:16 +0800
Message-ID: <3DB353E5-944D-4E18-9DA2-4151F44AA59B@gmail.com> (raw)
In-Reply-To: <CADkLM=fo48tbJ75VPDDNgMV3f-QWLCk2TPujGP4ockxVDFRiTQ@mail.gmail.com>
References: <CADkLM=ckHkX7Of5SrK7g0LokPUwJ=kk8JU1GXGF5pZ1eBVr0=Q@mail.gmail.com>
	<aRJW2_Yy9ALMkZUa@nathan>
	<CADkLM=fo48tbJ75VPDDNgMV3f-QWLCk2TPujGP4ockxVDFRiTQ@mail.gmail.com>



> On Nov 11, 2025, at 06:33, Corey Huinker <corey.huinker@gmail.com> wrote:
> 
> 
> My attempts to test this all got stuck in wait_on_slots().  I haven't
> looked too closely, but I suspect the issue is that the socket never
> becomes readable because we don't send a query.  If I set free_slot->inUse
> to false before printing the command, it no longer hangs.  We probably want
> to create a function in parallel_slot.c to mark slots that we don't intend
> to give a query as idle.
> 
> Would that be preferable to skipping the creation of extra connections for parallel workers? I can see it both ways. On the one hand we want to give as true a reflection of "what would happen with these options", and on the other hand one could view the creation of extra workers as "real" vs a dry run.
> 
>  

I test the patch, but my first run was with no luck:

```
% vacuumdb --dry-run --echo -d evantest
SELECT pg_catalog.set_config('search_path', '', false);
vacuumdb: vacuuming database "evantest"
RESET search_path;
SELECT c.relname, ns.nspname FROM pg_catalog.pg_class c
 JOIN pg_catalog.pg_namespace ns ON c.relnamespace OPERATOR(pg_catalog.=) ns.oid
 CROSS JOIN LATERAL (SELECT c.relkind IN ('p', 'I')) as p (inherited)
 LEFT JOIN pg_catalog.pg_class t ON c.reltoastrelid OPERATOR(pg_catalog.=) t.oid
 WHERE c.relpersistence OPERATOR(pg_catalog.!=) 't'
 AND c.relkind OPERATOR(pg_catalog.=) ANY (array['r', 'm'])
 ORDER BY c.relpages DESC;
SELECT pg_catalog.set_config('search_path', '', false);
VACUUM (SKIP_DATABASE_STATS) pg_catalog.pg_proc; (not executed)

^CCancel request sent
^CCancel request sent
^CCancel request sent
^CCancel request sent
```

After skip the first vacuum command, the process got stuck, and ctrl-c couldn’t break it.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/









view thread (32+ messages)  latest in thread

Message-ID: <3DB353E5-944D-4E18-9DA2-4151F44AA59B@gmail.com>
Permalink:  ../3DB353E5-944D-4E18-9DA2-4151F44AA59B@gmail.com/
Also on:    postgresql.org/message-id/3DB353E5-944D-4E18-9DA2-4151F44AA59B@gmail.com

 · 

reply

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, corey.huinker@gmail.com, nathandbossart@gmail.com
  Subject: Re: vacuumdb: add --dry-run
  In-Reply-To: <3DB353E5-944D-4E18-9DA2-4151F44AA59B@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