-
最も簡単な方法:
set synchronous_commit=offを追加します\i update.sqlの前 -
より良い:
- ファイルを100000更新などの部分に分割します。
split -l 100000 -a 6 --additional-suffix=.sql update.sql update-part - これらの更新を並行して実行し、各ファイルを単一のトランザクションで実行します。たとえば、次のようにします。
/bin/ls update-part*.sql \ | xargs --max-procs=8 --replace psql --single-transaction --file={}
- ファイルを100000更新などの部分に分割します。