Re: How to vacuum entire database excluding some tables in PostgreSQL9.1.

From: ProPAAS DBA <dba(at)propaas(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: How to vacuum entire database excluding some tables in PostgreSQL9.1.
Date: 2016-12-21 18:16:28
Message-ID: 91979dcd-9168-734d-e7e0-25f35d2ebd2f@propaas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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(dot)chandra(at)cyient(dot)com
> <mailto:%7Cdinesh(dot)chandra(at)cyient(dot)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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jeremy Harris 2016-12-25 13:33:55 Re: bad performance
Previous Message Dinesh Chandra 12108 2016-12-21 17:49:16 How to vacuum entire database excluding some tables in PostgreSQL9.1.