Just a short background.
using Perl-DBI to pull data from mssql into PG and \copy into a temp
table where the following is done.
my $query1 = "DELETE FROM $table_name
WHERE $unique_id in
(SELECT $unique_id from $table_name_loading)";
my $query2 = "INSERT INTO $table_name SELECT * FROM $table_name_loading";
my $query3 = "UPDATE sync_log SET last_sync=?,
record_update_date_time=current_timestamp
WHERE table_name=?
AND db_name = ?";
my $query4 = "TRUNCATE TABLE $table_name_loading";
I constantly see an operation in htop (an alternative to top)
postgres:username databasename 127.0.0.1(37833) PARSE
which sucks up huge blobs of my CPU time and I would like to know what it is exactly.
I would not be surprised if it's the DELETE which is the bottleneck, as it's DELETING
from a huge table > 6 million in size from the loading_temp_table.