PostgreSQL scaling up to 64 cores?

In this Computer World article, it specifies that PostgreSQL can scale up to a core limit of 64. Does this mean for one multi-core processor of 64 cores? Or multiple processors with fewer cores?

The reason why I ask is because I am trying to find how much processors PostgreSQL may scale up to but of course that may be limited to the type of processor. However, I've been finding other statistics in other databases (i.e. Microsoft SQL Server here stating it can scale up to 320 logical processors) and they don't specify their number of cores. Is this a very vague statistic?

Any thoughts would be much appreciated. Thanks!


Solution 1:

No it's a very precise statistic. A "logical processor" is a core. And a core is just that, it doesn't matter how they're spread over physical processors.

And if you're dealing with a machine with more cores than the supported number, this shouldn't be an issue with PostgreSQL. Each connection is inherently single-threaded* so whatever number of cores you have is what's going to limit the efficiency and efficacy of concurrent connections.

Needless to say this also means you should put your money in faster cores than quantity of cores unless you want to cluster things in a more complicated method.

* 2017 Update: Some queries (or subqueries) may be executed in parallel.

Solution 2:

Postgres can scale up to as many processors as you want to install, and your OS can handle/manage effectively. You can install Postgres on a 128 core machine (or even a machine with 128 physical processors) and it will work fine. It may even work better than on a 64 core machine if the OS scheduler can handle that many cores.

Postgres has been shown to scale linearly up to 64 cores (with caveats: We're talking about read performance, in a specific configuration (disk, RAM, OS, etc.) -- Robert Haas has a blog article with a nice graph which I've reproduced below:

enter image description here

What's important about this graph?

The relationship is linear (or nearly so) as long as the Number of Clients is less than or equal to the Number of Cores, and then begins what looks to be roughly a log-linear decrease in performance as you have more client connections than you do cores to run Postgres backends on because the backends start fighting for the CPU (load average goes above 1.0, etc...).

While it has only been demonstrated for up to 64 cores, you can generalize that you can keep adding cores (and clients) and keep improving performance, up to the limit of some other subsystem (disk, memory, network) where processes are no longer having CPU contention problems but are instead waiting on something else.

(Haas also has another article where they proved linear scalability to 32 cores which has some great reference material on scalability in general -- highly recommended background reading!)