stevec
stevec

Reputation: 52268

Extract a csv of heroku table - postgresql table size larger than database?

I have run

heroku pg:psql -a appname -c "\copy (SELECT * FROM listings) TO listings.csv CSV DELIMITER ',' HEADER"

expecting a dump of the listings table.

Instead, the file keeps growing and growing, and is (somewhat illogically) larger than the entire app database obtained through

heroku pg:backups:capture
heroku pg:backups:download

Which is confusing.

I am trying to simply make a csv copy of a table from a rails app in heroku.

Upvotes: 1

Views: 33

Answers (1)

Jim Jones
Jim Jones

Reputation: 19623

According to the TOAST documentation, PostgreSQL applies some compression techniques to the data storage:

The compression technique used for either in-line or out-of-line compressed data is a fairly simple and very fast member of the LZ family of compression techniques. See src/common/pg_lzcompress.c for the details.

Upvotes: 1

Related Questions