Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been running PostgreSQL on Windows Server 2003 without a hitch and its fast, so to answer my own question it seems fine.

However I am about to launch a new project and am considering using a Linux box instead as stability and performance are crucial. Since PostgreSQL seems to be developed on Linux distributions mostly, maybe it would be better to stick with Linux?

share|improve this question

migrated from stackoverflow.com Jan 14 '11 at 12:20

This question came from our site for professional and enthusiast programmers.

1  
choosing a platform is a sysadmin function, even if it is performed by a developer. –  araqnid Jan 14 '11 at 10:56
    
Related: serverfault.com/questions/99068/… –  ChristopheD Jan 14 '11 at 11:48
    
Seems to me like pg extensions are packaged for linux before they are for windows. –  Neil McGuigan Nov 19 '13 at 22:26

4 Answers 4

up vote 23 down vote accepted

PostgreSQL will definitely run faster on Linux than on Windows (and I say this as one of the guys who wrote the windows port of it..) It is designed for a Unix style architecture, and implements this same architecture on Windows, which means it does a number of things that Windows isn't designed to do well. It works fine, but it doesn't perform as well.

For example, PostgreSQL uses a process-per-connection model, not threading. Windows is designed to do threading. If your application does lots of connect and disconnects, it will definitely run significantly slower on Windows, for example.

There is also some assumptions around the filesystem which don't exactly favor NTFS.

The one thing you really need to think about - if you are on Windows, most antivirus products will bug out when used with PostgreSQL, because they are not used to this type of workload (such as 1000 different processes reading and writing to the same file through different handles). That means that the strong recommendation is to always uninstall any antivirus if possible (just disabling it or excluding the PostgreSQL processes/files is often not enough). And this is not just for performance reasons, but also stability under load.

share|improve this answer
    
Thanks! Nice to have an authorative answer, though in my case sticking to Windows sounds fine: I very few connections and no anti virus (I dislike them too). Performance has been great too: I think Windows caching and IO speed (when you have up to date drivers) helps me there.. –  user55029 Jan 24 '11 at 8:19
    
It would be nice to see some real world throughput benchmarks... –  user55029 Feb 14 '11 at 23:22
1  
BTW, use of a connection pool will be particularly helpful on Windows due to the greater process creation/destruction costs. –  Craig Ringer Nov 23 '12 at 10:49
    
I did do side-by-side comparisons of PostgreSQL on Windows versus Linux in the old 8.1 and 8.2 days. For our load Linux was about 50% faster. It's not clear how much of that was just the networking, though, because clients were on a separate box and using the same Java code to test raw network throughput on an open connection ran 30% faster when both sides were Linux than when both sides were Windows. Interestingly, when one side was Linux and one was Windows it was 15% slower than both sides Linux. –  kgrittn Nov 23 '12 at 16:22

This is hard to answer: As Ken noted, Postgres doesn't make any differences between the OS and it is as stable/unstable in Windows as it is on Linux.

The only real answer to this question is: try it.

Set up a Linux server and a Windows server with the same specs, use the same amount of data on both machines and run your tests.

PS: This has close votes because it may be better asked at serverfault

share|improve this answer
    
Is it better on ServerFault? I would have categorised it as a software problem for developers rather than a issue for an systems admin. –  user55029 Jan 14 '11 at 10:17
1  
This ain't a software problem, no developer has ever to worry about his SQL: PostgreSQL uses the samen SQL on Linux as it does on Windows. –  Frank Heikens Jan 14 '11 at 12:29

It is my understanding that, for the same hardware, you will get better performance on Linux as opposed to Windows. Also, while Postgres does run on windows, it has been running on *nix for much, much longer. YMMV of course depending on your situation.

A really good reference on Postgres performance is "PostgreSQL 9.0 High Performance" (https://www.packtpub.com/postgresql-9-0-high-performance/book). The title is a bit of a misnomer as it covers more than just version 9.0.

share|improve this answer

AFAIK Postgres does not discriminate, they don't cripple features on Windows, or anything like that. So there is nothing about Postgres that requires Linux.

You might be better off asking generally about Linux. vs. Windows as a general server platform.

OPINION: But for my money a server always runs Linux. Would never dream of putting mission-critical server software on Windows. Just my 2 cents. End of Opinion.

share|improve this answer
    
stability and **performance** are crucial –  FractalizeR Apr 25 at 9:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.