Extracting subsets of data

Up until now, we have seen how to dump an entire database. However, this is not what we might wish for. In many cases, we just want to extract a subset of tables or schemas.  Fortunately, pg_dump can help us do that while also providing a number of switches:

  • -a: It only dumps the data and does not dump the data structure
  • -s: It dumps the data structure but skips the data
  • -n: It only dumps a certain schema
  • -N: It dumps everything but excludes certain schemas
  • -t: It only dumps certain tables
  • -T: It dumps everything but certain tables (this can make sense if you want to exclude logging tables and so on)

Partial dumps can be very useful in order to speed things up considerably.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset