I have a problem with libpq on windows. Connecting to a db a开发者_如何学Cnd running a "select * from some_table;" is very slow.
The table has only 1800 rows, 7 columns. No blobs etc.
The query is taking around 3500ms, in linux it takes around 800ms. (About 500ms is network time, the server is on the opposite side of the world from my location.)
The hardware is identical (dual boot)
Why does this so long in windows? I tested in pqsl, and pgadmin to rule out errors in the app code.
Any advice or clues?
I would be willing to bet that the real problem is antivirus software acting up. It is true that PostgreSQL on Windows may not perform quite as well as on Linux, but the differences you are seeing cannot be simply in relation to the differences between multiple processes and multiple threads (copy on write, etc).
The very first thing to do is to rule out causes like antivirus software. Because this software sits in between reads and writes of disk I/O it has the capability of making your disk I/O significantly slower. Additionally if it is slow enough it may render sequential disk I/O performance more like random disk I/O which is not a good thing. So try with your antivirus switched off (and preferably not connected to a network).
A second thing I would look at is filesystem fragmentation. Are these files heavily fragmented? If so, disk I/O will be more expensive as well. Beyond this, doing a clean boot, starting the service manually, and trying this again may rule out other programs interfering with disk I/O.
Once you have the problem ruled down, then it should be simple to come up with a solution.
精彩评论