Thread: [PERFORM] How to vacuum entire database excluding some tables in PostgreSQL9.1.

[PERFORM] How to vacuum entire database excluding some tables in PostgreSQL9.1.

From
Dinesh Chandra 12108
Date:

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

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.

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

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.