in reply to Stream data into Postgresql

Well, just a general comment: it's typical for DBI to operate very slowly on large numbers of sql transactions; any RDBMS worth having will provide its own compiled utility for loading data into a table from a file or other stream, and this utility will usually run many times faster than DBI, doing the same large task.

So think about setting up a perl script to use an external, RDB-specific utility to load the actual data into the table. (Other stuff, like creating the table, or massaging the data as it goes in, should be quick enough in perl.)