Sample Header Ad - 728x90

Copy in SQL with index vs without index

-1 votes
1 answer
2445 views
Recently I have received a data dump in csv format that I am trying to import in my PSQL database. The dump consists of 8 csv file each of size 7GB. I have found that using the Copy command on one file is incredibly slow if the indexes are defined on the table. I have 2 indexes, one on 3 fields and one on 2. Whereas copy on table with no index takes roughly 2 minutes. I was wondering, what is the best practice to copy and index big data files from CSV, for now, copying then reindexing seems like my best options. Is there any best practice for that. Why is copy incredibly slow when indexing data?
Asked by user163436 (1 rep)
Oct 22, 2018, 08:05 PM
Last activity: Oct 23, 2018, 04:00 AM