What is the effect of number of CPU cores on update operations in Postgres? I have batch update operations being sent to the PostgreSQL server to be executed. Each operation (batch) will be updating rows in the same table but it is assured that they will be updating different rows.
Given this, is it safe to assume that the a 2 fold increase in throughput can be countered by doubling the number of CPU cores?
The additional CPUs can only be used if you use more sessions/connections.
If you increase the number of sessions, then a higher number of CPUs should show an increase in throughput. However, the throughput is not only limited by CPU, but also by the capacity of your I/O system. If the current workload is I/O bound (i.e. limited by the performance of the disks) then adding more sessions (and more CPUs) is not going to increase the throughput (it's probably making it worse).
If your disks are not saturated with the current workload, then adding CPUs and using more sessions is likely to improve the throughput. But this is typically not linear, i.e. doubling the number of CPUs and sessions might only give you an x1.5 increase in throughput. Typically this curve flattens. If you increase concurrency from 5 to 10 sessions, this will probably double your throughput (again: assuming you are not limited by I/O). But going from 100 to 200, is probably not going to double the throughput.