I am using postgres database with PostGIS and PGAdmin. I have many .sql files with different sizes like 300MB, 280MB etc to be inserted into database. What is the best way to do it i.e through java code or some psql commands. I am very new to java and postgres database also. Please give me some suggestion.
Use psql
command line tool:
psql -f file_with_sql.sql
This command executes all commands line-by-line (except when file contains BEGIN…END blocks. In this case commands in blocks executes in transaction). To wrap all commands in transaction use --single-transaction
switch:
psql --single-transaction -f file_with_sql.sql
For more options:
psql --help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With