pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ProPAAS DBA <dba@propaas.com>
To: pgsql-performance@postgresql.org
Subject: Re: How to vacuum entire database excluding some tables in PostgreSQL9.1.
Date: Wed, 21 Dec 2016 11:16:28 -0700
Message-ID: <91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.com> (raw)
In-Reply-To: <ff263c2c0003460f8711d11b1e8838dc@cyient.com>
References: <ff263c2c0003460f8711d11b1e8838dc@cyient.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

Something like this in a bash script?


#!/bin/bash

echo "select schemaname, tablename from pg_tables where tablename not in 
(your list of excluded tables) and schemaname not in 
('information_schema', 'pg_catalog')" | psql -t > /tmp/tablist

exec < /tmp/tablist
while read line
do
      set - $line
      echo "Vacuuming [$1] [$3]"
      echo "VACUUM VERBOSE ${1}.${3}" | psql

done




On 12/21/2016 10:49 AM, Dinesh Chandra 12108 wrote:
>
> Dear Expert,
>
> Could you please suggest me for the below query?
>
> *I want to vacuum the entire database with the exception of several*
>
> *tables.*
>
> Because there are some tables which are very big in size, so I just 
> want to exclude them.
>
> Thanks in advance.
>
> *Regards,*
>
> *Dinesh Chandra*
>
> *|Database administrator (Oracle/PostgreSQL)| Cyient Ltd. Noida.*
>
> *------------------------------------------------------------------*
>
> Mobile: +91-9953975849 | Ext 1078 |dinesh.chandra@cyient.com 
> <mailto:%7Cdinesh.chandra@cyient.com>
>
> Plot No. 7, NSEZ, Phase-II ,Noida-Dadri Road, Noida - 201 305,India.
>
>
> ------------------------------------------------------------------------
>
> DISCLAIMER:
>
> This email message is for the sole use of the intended recipient(s) 
> and may contain confidential and privileged information. Any 
> unauthorized review, use, disclosure or distribution is prohibited. If 
> you are not the intended recipient, please contact the sender by reply 
> email and destroy all copies of the original message. Check all 
> attachments for viruses before opening them. All views or opinions 
> presented in this e-mail are those of the author and may not reflect 
> the opinion of Cyient or those of our affiliates.

view thread (2+ messages)

Message-ID: <91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.com>
Permalink:  ../91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.com/
Also on:    postgresql.org/message-id/91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.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-performance@postgresql.org
  Cc: dba@propaas.com
  Subject: Re: How to vacuum entire database excluding some tables in PostgreSQL9.1.
  In-Reply-To: <91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.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