Reputation: 4011
Let's say I have an enum: CREATE TYPE foo AS ENUM ('a', 'b', 'c')
And a column in my table of type foo
.
Assuming I want to insert a .tsv file that has, as the value respective to the enum column the string "a"
or "b"
or "c"
, what is the most efficient way to go about doing that ?
I have ~90 million rows here, so inserting them one by one could be considerably slower.
Upvotes: 1
Views: 1012
Reputation: 37472
Postgres provides the COPY
command for importing data from a file. If the strings in the file are exactly written as the enum members, this should work out of the box.
COPY elbat
(nmuloc_1,
...,
nmuloc_n)
FROM '/path/to/file.tsv';
Upvotes: 1