Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jj6bQ-00054g-PL for pgsql-performance@arkaria.postgresql.org; Wed, 10 Jun 2020 19:41:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jj6ar-0005yI-BB for pgsql-performance@arkaria.postgresql.org; Wed, 10 Jun 2020 19:41:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jj6PG-0001Ql-O3 for pgsql-performance@lists.postgresql.org; Wed, 10 Jun 2020 19:29:03 +0000 Received: from 0190701781.0.fullrate.ninja ([90.185.254.91] helo=mail.tala.dk) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jj6P9-0000xW-N0 for pgsql-performance@postgresql.org; Wed, 10 Jun 2020 19:29:01 +0000 Received: from tala.dk (localhost [IPv6:::1]) by mail.tala.dk (Postfix) with ESMTP id 877E960015986 for ; Wed, 10 Jun 2020 21:28:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.tala.dk 877E960015986 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tala.dk; s=mail; t=1591817331; bh=TfeYjeXT2cl3IXW4tYPS4AarRTZCsGL0be9wTqIS6Hg=; h=Date:From:To:Subject:From; b=jUXSBTBjYCpN7lcGg3Q2ECFjEY/gq37a6Cq4omW7BbQRmCWIplZuKY5+hsS1TXGne 0xT1KHOILXhq9aGp6MQLjEaFGwhIfTjkn4pdhphBnO8lalgCZK3M0I8fWUUI2snd4q S/4WrcavyEmfwIuejkDCJL8D5ypSl800Lcg4c8Xc= MIME-Version: 1.0 Date: Wed, 10 Jun 2020 21:28:51 +0200 From: Mikkel Lauritsen To: pgsql-performance@postgresql.org Subject: Windows slowness? User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: renard@tala.dk Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi all, I have a query that runs much slower in Postgres on Windows than on Linux, and I'm so far unable to explain why - the execution plans are identical and the hardware is reasonably the same caliber. Using explain analyze on the database running on Windows I get -> Index Scan using event_pkey on event t1 (cost=0.56..0.95 rows=1 width=295) (actual time=0.075..0.075 rows=0 loops=229227) The server is Postgres 12, and for reasons outside of my control it runs on Windows 2012 on a virtual server. It has 4 cores and 32 GB ram allocated on a Xeon E5 4660 v4, and running winsat shows satisfactory disk and memory bandwidth and CPU performance. If I copy the database to my laptop running Linux (Postgres 12 on Fedora 32, i7-9750H, 16 GB ram) I get the exact same execution plan. Explain analyze says -> Index Scan using event_pkey on event t1 (cost=0.56..0.95 rows=1 width=295) (actual time=0.008..0.008 rows=0 loops=229227) Note that the index scans are more than 9 times faster on my laptop, and the entire query executes about 12 times faster. I realize that each core in the laptop CPU is faster than a server core and that virtualization doesn't help performance, but I wouldn't expect that to make the Windows box 10 times slower. The table is freshly vacuumed. It has about 10M rows and takes about 2.6G disk space; the index is about 600M. Everything is cached; there's basically no disk I/O happening while the query is executing. The only Postgres configuration difference between the Windows and Linux environments is shared_buffers, which is 4G on my laptop and 512M on the Windows server, and effective_cache_size which are 8G on the laptop and 16G on the server. I suspect that something is rotten in for example the provisioning of the virtualization environment, but before I start pestering the operations people I would really appreciate any comments on whether the performance difference is to be expected or if there's some obvious tuning to try. Best regards & thanks, Mikkel Lauritsen