Re: How to generate file from postgres data - Mailing list pgsql-general

From Vijaykumar Jain
Subject Re: How to generate file from postgres data
Date
Msg-id CAM+6J94y2NXiRC-zKbS8asTPcQ7CbDeJ_BtfpM_wS8V1m0D+TQ@mail.gmail.com
Whole thread Raw
In response to How to generate file from postgres data  (Shubham Mittal <mittalshubham30@gmail.com>)
Responses Re: How to generate file from postgres data  (Vijaykumar Jain <vijaykumarjain.github@gmail.com>)
List pgsql-general

test=# create table t(id int, value text);
CREATE TABLE
test=# insert into t select x, x::text from generate_series(1, 1000) x;
INSERT 0 1000
test=#  COPY (select * from t where id < 50 order by id desc)  TO '/tmp/report.csv' DELIMITER ',' CSV HEADER;   ---- copy out the results via a view or sql directly
COPY 49
test=# \q
postgres@db:~/playground$ head -5 /tmp/report.csv
id,value
49,49
48,48
47,47
46,46

and send the csv tar zip compressed etc.

How does your client intend to load 1gb report in a viewer ? paginated ? all at once ?

pgsql-general by date:

Previous
From: Shubham Mittal
Date:
Subject: How to generate file from postgres data
Next
From: Vijaykumar Jain
Date:
Subject: Re: How to generate file from postgres data