What's the best way to copy a subset of a table's rows from one database to another in Postgres?

后端 未结 4 1366
我在风中等你
我在风中等你 2021-02-04 17:52

I\'ve got a production DB with, say, ten million rows. I\'d like to extract the 10,000 or so rows from the past hour off of production and copy them to my local box. How do I do

4条回答
  •  悲&欢浪女
    2021-02-04 17:59

    From within psql, you just use copy with the query you gave us, exporting this as a CSV (or whatever format), switch database with \c and import it.

    Look into \h copy in psql.

提交回复
热议问题