Skip to content

Conversation

@anayrat
Copy link
Collaborator

@anayrat anayrat commented May 15, 2024

Partitioned tables are empty, thus last_* are null.

Fix #365

It changed since : https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=0827e8af70f4653ba17ed773f123a60eadd9f9c9

@Krysztophe
Copy link
Collaborator

We should not ignore relkind = 'p' for last_analyze, right?

@blogh
Copy link
Collaborator

blogh commented Jul 3, 2025

Hi,

Would this work for you @Krysztophe & @anayrat ?

diff --git a/check_pgactivity b/check_pgactivity
index 16dfc5e..1135c92 100755
--- a/check_pgactivity
+++ b/check_pgactivity
@@ -5057,7 +5057,8 @@ sub check_last_maintenance {
             JOIN pg_class b on a.relid = b.oid
             WHERE schemaname NOT LIKE 'pg_temp_%'
               AND schemaname NOT LIKE 'pg_toast_temp_%'
-              AND relkind <> 'p' -- partitioned table do not have last_* information
+              AND (('${type}' = 'vacuum' AND relkind <> 'p') -- partitioned table do not have last_* information
+               OR  ('${type}' = 'analyze'))
         }
     );

@yhuelf
Copy link
Contributor

yhuelf commented Jul 29, 2025

@blogh's suggestion looks good to me.

@gleu
Copy link
Collaborator

gleu commented Oct 1, 2025

@anayrat Can you fix your PR with @blogh suggestion? Thanks.

Partitioned tables are empty, thus last_* are null.

Fix OPMDG#365
@anayrat
Copy link
Collaborator Author

anayrat commented Oct 17, 2025

Hello,
I applied @blogh suggestion.

@frost242 frost242 merged commit 13670d5 into OPMDG:master Oct 17, 2025
@frost242
Copy link
Member

Thanks @anayrat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

last_vacuum : ignore partitions

6 participants