Logical replication might be another option. Although I am not sure if that is even possible inside the samme database. I know it's tricky inside the same server (between different databases)
If you can get outside sql, the bulk copy facilities (CopyManager in java) is blindingly fast for me.
??
I meant using tools other than sql (and psql). I have java code using org.postgresql.copy package because straight insert was too slow for large numbers of rows.