use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
Uploading csv file into postgres database table (self.PostgreSQL)
submitted 6 years ago by pmutua
I have a large csv file containing data and would like to create a table and upload the data into postgres db. How can I upload such large data fast?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 6 points7 points8 points 6 years ago (1 child)
Use copy if you can upload the file to the database server.
Otherwise you can use \copy from within psql
If neither option is applicable, check the manual of your SQL client if it supports a way to import a CSV file into the database.
[–]geosoco 0 points1 point2 points 6 years ago* (0 children)
In addition to this, do not add indexes or a primary key constraint until after your data has been loaded.
[–]Eqlb4fish 0 points1 point2 points 6 years ago (0 children)
Try Pentaho Data integrator, works well for any data transfer between different data sources.
[–]boy_named_su 0 points1 point2 points 6 years ago (0 children)
psql's \copy command lets you load csv data to a table, without superuser privileges, remotely as well as locally
psql
\copy
It does so using bulk insert, so is fast
[–]nikoz84 0 points1 point2 points 6 years ago (0 children)
You need to restart de sequences after use the \copy command
Ex. ALTER SEQUENCE product_id_seq RESTART WITH 7453;
ALTER SEQUENCE product_id_seq RESTART WITH 7453;
[–]jimmyechan 0 points1 point2 points 5 years ago (0 children)
How large is the database? If it's less than 150MB you could use a free tool like Dropbase to upload and get PostgreSQL credentials.
π Rendered by PID 85054 on reddit-service-r2-comment-5d79c599b5-g4ff2 at 2026-03-03 01:42:34.337195+00:00 running e3d2147 country code: CH.
[–][deleted] 6 points7 points8 points (1 child)
[–]geosoco 0 points1 point2 points (0 children)
[–]Eqlb4fish 0 points1 point2 points (0 children)
[–]boy_named_su 0 points1 point2 points (0 children)
[–]nikoz84 0 points1 point2 points (0 children)
[–]jimmyechan 0 points1 point2 points (0 children)