CodeForAfrica / HURUmap-Data

0 stars 0 forks source link

Switch to COPY instead of INSERT #7

Open karimkawambwa opened 4 years ago

karimkawambwa commented 4 years ago

Some SQL files are getting large and can take a few seconds to get executed. For better performance and reducing sql file sizes, we can run the script to update/reformat then overwrite the csv files. The SQL will then just have to use the COPY command:

COPY persons(first_name,last_name,dob,email) 
FROM 'C:\tmp\persons.csv' DELIMITER ',' CSV HEADER;

https://www.postgresqltutorial.com/import-csv-file-into-posgresql-table/

cc @kilemensi @KhadijaMahanga @ascii-dev

karimkawambwa commented 4 years ago

NOTE: If this is not a problem then we don't need to do this.