Return to Snippet

Revision: 30029
at August 6, 2010 07:44 by jturmel

Initial Code
# Development Server

psql database_name
CREATE TABLE temp_table_name AS SELECT * FROM actual_table WHERE some_field = 'some_value' ORDER BY some_field;

pg_dump -t temp_table_name database_name | gzip > temp_table_name.sql.gz
scp temp_table_name.sql.gz [email protected]:
psql database_name
DROP TABLE temp_table_name;

# Production Server

zcat temp_table_name.sql.gz | psql database_name
psql database_name
INSERT INTO actual_table SELECT * FROM temp_table_name;
DROP TABLE temp_table_name;

Initial URL

Initial Description

Initial Title
Export/import subset of data from table in Postgres

Initial Tags
table, data

Initial Language