No, I meant how many clients are connecting to the master and performing INSERTs. It sounds like the answer is “one”. Since the next INSERT won’t begin processing until the previous one has returned successfully, a single client is very limited. Since we’re doing
additional processing above and beyond what PostgreSQL does to plan a query, the time to process a single row will be
higher than in typical PostgreSQL.
In other words, even though you have two workers, your client is only ever talking to one at a time. To see better performance, use multiple clients. The -c and -j arguments to pgbench can help here, or you can do something like what’s described in
this blog post and use xargs -P to parallelize a script that talks to your cluster. In that case, Marco saw 50,000 rows/second using 64 processes to ingest data. Your mileage may vary, but you’ll never get the best throughput with a single client… parallelism is a must to load data quickly into a distributed system.