这里我需要在我的数据库表中插入大量记录。我怎么能在PostgreSQL 9.3版本中做到这一点?
示例:
/* Table creation */
create table tabletest(slno int,name text,lname text, address text, city text);
/* Records insertion */
insert into tabletest values -- Here i need to insert thousands of records in a bulk.
答案 0 :(得分:2)
简答:使用COPY
命令。
请注意,该文件应该可供Postgres服务器计算机使用,因为COPY
主要由DBA使用。
而且,如果你有Excel,你必须首先将数据导出为CSV格式,因为Postgres不能直接读取Excel格式的数据。