''m using postgresql 9.5.
For one id I can query as follows:
select a,b from mytable where id = '1234' order by a,b;
Q1.
I have 50 unique id's of interest in a txt file. How do I run ^ query on all those 50 id's in one go?
(Overall there are about 100000 records in the mytable
)
Q2.
If possible I'd also like to save the results recursively to different text files.
For 1 file I can do
COPY "select a,b from mytable where id = '1234' order by a,b;" TO STDOUT CSVHEADER > '/tmp/1234.csv'
Ref: psql - save results of command to a file
Save PL/pgSQL output from PostgreSQL to a CSV file
Extra Info :
I'm querying from my local machine.
The postgres is installed on AWS. (I have read access to the db).