Linux – Does PostgreSQL perform on Windows as well as on Linux

linuxperformancepostgresqlwindows

This topic was brought up in 2011, and the consensus was that there were design considerations that would give PostgreSQL a leg up on Linux. It is now 2015, has that changed? If there are things that make PostgreSQL slower on Windows, can somebody summarize those points?

Best Answer

If the points that I lay out in this answer are taken care of I would say PostgreSQL still performs reasonably well with Windows. Comparing to the year 2011 I don't see any major difference though.

From my experience it's mostly about taking care that no Windows process gets in the way so this quote from the book PostgreSQL 9.0 High Performace (2010) still largely holds:

Unpredictable performance and Windows

Serious database administrators have a strong historical bias toward using UNIX-like systems for their servers. The first examples here are using Windows instead because the graphs produced are easier to read, and therefore better for introducing the concepts of this section. But doing so reminded me why Windows is not the preferred database hosting operating system of so many people.

Getting useful benchmark results requires the system be quiescent: free of other programs running that would spoil the results of what is intended to be measured. When booting into Windows Vista to generate these results, I discovered the TrustedInstaller process was hogging a considerable amount of CPU and disk resources. It turned out Windows Update had decided it was time to install the next major Vista Service Pack; it was downloading pieces in the background, and pushing me toward the upgrade at every opportunity. It was two hours later before I had completed all the background activity it compelled me to take care of, and had an idle system capable of running these tests.

You might think that favouring Server Core edition of Windows 2012 might remedy this a bit. MSDN article Why Is Server Core Useful? (about Windows 2008) says however:

Before we look at the benefits of Server Core, let's debunk a misconception: Improved performance is not one of the benefits of running Server Core instead of a Full installation of Windows Server 2008.

Other than that the memory handling is also different in Windows and at times counterintuitive. This too is the same as in 2011. The shared_buffers for example (from PostgreSQL Documentation - 18.4. Resource Consumption):

on Windows, large values for shared_buffers aren't as effective. You may find better results keeping the setting relatively low and using the operating system cache more instead. The useful range for shared_buffers on Windows systems is generally from 64MB to 512MB.