Slow insert on PostgreSQL using JDBC
<p>I work on a system which downloads data from a cloud system to a local database (PostgreSQL, MySQL, ...). Now I'm having an issue with PostgreSQL performance because it takes a lot of time to insert the data.</p>

<p>A number of columns and the size of the data may vary. In a sample project, I have a table with approx. 170 columns. There is one unique index - but even after dropping the index the speed of the insert did not change.</p>

<p>I'm using JDBC driver to connect to the database and I'm inserting data in batches of 250 rows (using <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html">NamedParameterJdbcTemplate</a>).</p>

<p>It took me approx. <strong>18 seconds to insert the data on Postgres</strong>. The same data set <strong>on MySQL took me just a second</strong>. That's a huge difference - where does it come from? Is Postgres JDBC driver that slow? Can it be configured somehow to make it faster? Am I missing something else? The difference between Postgres and MySQL is so huge. Any other ideas how to make it faster?</p>

<p>I made a sample project which is available on Github - <a href="https://github.com/varad/postgresql-vs-mysql">https://github.com/varad/postgresql-vs-mysql</a>. Everything happens in <a href="https://github.com/varad/postgresql-vs-mysql/blob/master/src/main/java/LetsGo.java">LetsGo class</a> in the "run" method.</p>