pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <a.mantzios@cloud.gatewaynet.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Index file is growing when I drop a table. Why?
Date: Thu, 16 Nov 2023 19:22:20 +0200
Message-ID: <810a0a70-0fbc-400c-bc67-f9d627f103be@cloud.gatewaynet.com> (raw)
In-Reply-To: <CANzqJaBZLxdF+057oKo468nu7nq0jr+6tyOcTM-P6Cy+3kh3jQ@mail.gmail.com>
References: <CANzqJaBZLxdF+057oKo468nu7nq0jr+6tyOcTM-P6Cy+3kh3jQ@mail.gmail.com>

Στις 16/11/23 18:32, ο/η Ron Johnson έγραψε:
> Pg 15.4
>
> I'm dropping the large table "bar" in a test database, and it's taking 
> a /long/ time.  Thus, I thought I'd watch it deleting files.
>
> To my surprise, though, the files that store the index are growing.  
> What's up with that?

What does pg_locks show ?

SELECT blocked_locks.pid AS blocked_pid,
    blocked_activity.usename AS blocked_user,
    blocking_locks.pid AS blocking_pid,
    blocking_activity.usename AS blocking_user,
    blocked_activity.query AS blocked_statement,
    blocking_activity.query AS blocked_by
   FROM pg_locks blocked_locks
     JOIN pg_stat_activity blocked_activity ON blocked_activity.pid = 
blocked_locks.pid
     JOIN pg_locks blocking_locks ON blocking_locks.locktype = 
blocked_locks.locktype AND NOT blocking_locks.database IS DISTINCT FROM 
blocked_locks.database
AND NOT blocking_locks.relation IS DISTINCT FROM blocked_locks.relation 
AND NOT blocking_locks.page IS DISTINCT FROM blocked_locks.page AND NOT 
blocking_loc
ks.tuple IS DISTINCT FROM blocked_locks.tuple AND NOT 
blocking_locks.virtualxid IS DISTINCT FROM blocked_locks.virtualxid AND 
NOT blocking_locks.transactioni
d IS DISTINCT FROM blocked_locks.transactionid AND NOT 
blocking_locks.classid IS DISTINCT FROM blocked_locks.classid AND NOT 
blocking_locks.objid IS DISTINCT
FROM blocked_locks.objid AND NOT blocking_locks.objsubid IS DISTINCT 
FROM blocked_locks.objsubid AND blocking_locks.pid <> blocked_locks.pid
     JOIN pg_stat_activity blocking_activity ON blocking_activity.pid = 
blocking_locks.pid
  WHERE NOT blocked_locks.granted;

>
> foo=# select * from pg_class where oid = 41533;
> -[ RECORD 1 ]-------+----------
> oid                 | 41533
> relname             | i_bar_su1
> relnamespace        | 2200
>
> $ pwd
> /var/lib/pgsql/15/data/base/16482
> $ la -aFl 41533*
> -rw------- 1 postgres postgres 1073741824 2023-11-16 11:15:06 41533
> -rw------- 1 postgres postgres  189792256 2023-11-16 11:24:15 41533.1
>
> Five minutes later, 41533.1 is 4.3MB larger.
>
> $ dir 41533*
> -rw------- 1 postgres postgres 1073741824 2023-11-16 11:15:06 41533
> -rw------- 1 postgres postgres  194101248 2023-11-16 11:29:44 41533.1
>
-- 
Achilleas Mantzios
  IT DEV - HEAD
  IT DEPT
  Dynacom Tankers Mgmt

view thread (3+ messages)  latest in thread

Message-ID: <810a0a70-0fbc-400c-bc67-f9d627f103be@cloud.gatewaynet.com>
Permalink:  ../810a0a70-0fbc-400c-bc67-f9d627f103be@cloud.gatewaynet.com/
Also on:    postgresql.org/message-id/810a0a70-0fbc-400c-bc67-f9d627f103be@cloud.gatewaynet.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-admin@postgresql.org
  Cc: a.mantzios@cloud.gatewaynet.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Index file is growing when I drop a table. Why?
  In-Reply-To: <810a0a70-0fbc-400c-bc67-f9d627f103be@cloud.gatewaynet.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