Page 1 of 1
2.2 GB of inserts.sql How to insert them.
Posted: Tue Nov 25, 2014 11:46 pm
by Benjamin_e
Hey, I have 2.2GB sql file with planty of inserts.
How do I Move it into the table?
When i try \i x.sql i get the message that said the file is too large.
Re: 2.2 GB of inserts.sql How to insert them.
Posted: Wed Nov 26, 2014 12:07 am
by JimKnicely
Interesting. What is the message exactly?
You could split the file into smaller files in Linux... Here is an example that creates smaller files having 2 lines each:
Code: Select all
[dbadmin@vertica01 jim]$ ls
x.sql
[dbadmin@vertica01 jim]$ cat x.sql
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
insert into jim values (1);
[dbadmin@vertica01 jim]$ split -l 2 -d -a 3 x.sql x.sql
[dbadmin@vertica01 jim]$ ls
x.sql x.sql000 x.sql001 x.sql002 x.sql003 x.sql004
[dbadmin@vertica01 jim]$ cat x.sql000
insert into jim values (1);
insert into jim values (1);
You may want to do 1000 inserts at a time in each file.
Re: 2.2 GB of inserts.sql How to insert them.
Posted: Wed Nov 26, 2014 12:49 am
by NorbertKrupa
Benjamin_e wrote:Hey, I have 2.2GB sql file with planty of inserts.
How do I Move it into the table?
When i try \i x.sql i get the message that said the file is too large.
Is this a one time insert? You should really try to avoid having so many single INSERTs.
Re: 2.2 GB of inserts.sql How to insert them.
Posted: Wed Nov 26, 2014 7:06 am
by Benjamin_e
After review the docs a out transfering I Modify it. the script has 10m inserta. Its planty even to split them. I manipulate the file to cs file delimited by ',' now i will use the opy command to move it.
Thank you.