Обсуждение: pg_dump: Exclude multiple tables in version 7.4

Поиск
Список
Период
Сортировка

pg_dump: Exclude multiple tables in version 7.4

От
cha
Дата:
Hi All,

I want to  dump the database by using pg_dump command but the problem is the
version at the server is 7.4 which doesn't support the provision for
excluding tables as in version 8.2.

There are 500+ tables in the database,from which 15-20 are of huge sizes.I
want to exclude them.Is there any way to do it?

I knw that I have to use include instead of excluding the tables.Do I have
to include each and every tables manually or is there way to do that?

Do i have to write the script for this? if yes, how should I proceed?

Please help me out with this issue.

Thanks in Advance.


Cheers,
Cha
-- 
View this message in context:
http://www.nabble.com/pg_dump%3A-Exclude-multiple-tables-in-version-7.4-tf3944401.html#a11188792
Sent from the PostgreSQL - pgadmin support mailing list archive at Nabble.com.



Re: pg_dump: Exclude multiple tables in version 7.4

От
"Melvin Davidson"
Дата:
>I knw that I have to use include instead of excluding the tables.Do I
have to include each and
>>every tables manually or is there way to do that?

There's no guarantee. but the following query might be a
good starting point to build your include list.

It selects only tables with less than 3000 tuples
(naturally you will change the value to suit your needs.

Note that per the documenatation:
"This is only an estimate used by the planner.
 It is updated by VACUUM, ANALYZE,
 and a few DDL commands such as CREATE INDEX."

So a FULL VACUUM is advised before executing.

SELECT n.nspname || ' .' || c.relname AS tablename
   FROM pg_class c
   LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
   LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
  WHERE c.relkind = 'r'::"char"
        AND reltuples < 3000
ORDER BY n.nspname;


Melvin Davidson
Database Developer
Computer & Communication Technologies, Inc.
6 Inverness Court East, Suite 220
Englewood, CO  80112

Вложения