Question

Can I programatically(or whichever way works fine) create the backup of a database, with only the tables I want? I have around 100 tables in my database and I want only 10 tables backup(ofcourse all are interdependant). How can I achieve this? And by the way I have a postgresql database.

Was it helpful?

Solution

Of course. pg_dump lets you pass list of tables with parameter -t

To clear some doubts. True, the -t parameter accepts only one pattern. But it's a pattern very similar to regular expression, so if you want to dump tables A, B & C you can do:

pg_dump -t '(A|B|C)' 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top