Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhAfo-001Xps-RO for pgsql-performance@arkaria.postgresql.org; Fri, 15 Sep 2023 15:24:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qhAfn-000zg2-4K for pgsql-performance@arkaria.postgresql.org; Fri, 15 Sep 2023 15:23:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhAfm-000zfM-P9 for pgsql-performance@lists.postgresql.org; Fri, 15 Sep 2023 15:23:58 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhAfj-004k3Z-Q9 for pgsql-performance@lists.postgresql.org; Fri, 15 Sep 2023 15:23:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 38FFNn4a3310211; Fri, 15 Sep 2023 11:23:49 -0400 From: Tom Lane To: Achilleas Mantzios - cloud cc: pgsql-performance@lists.postgresql.org Subject: Re: pgsql 10.23 , different systems, same table , same plan, different Buffers: shared hit In-reply-to: <24a36ca8-b5c0-d39f-c5f6-47cf2ef51abd@cloud.gatewaynet.com> References: <24a36ca8-b5c0-d39f-c5f6-47cf2ef51abd@cloud.gatewaynet.com> Comments: In-reply-to Achilleas Mantzios - cloud message dated "Fri, 15 Sep 2023 17:30:39 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3310209.1694791429.1@sss.pgh.pa.us> Date: Fri, 15 Sep 2023 11:23:49 -0400 Message-ID: <3310210.1694791429@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Achilleas Mantzios - cloud writes: > *FreeBSD* > > -> Index Only Scan using mail_vessel_addressbook_address_regex_idx > on mail_vessel_addressbook (cost=0.42..2912.06 rows=620 width=32) > (actual time=96.704..96.705 rows=1 loops=1) > Filter: ('foo@bar.com'::text ~* address_regex) > Rows Removed by Filter: 14738 > Heap Fetches: 0 > Buffers: shared hit=71 > > *Linux* > > -> Index Only Scan using mail_vessel_addressbook_address_regex_idx > on mail_vessel_addressbook (cost=0.42..2913.04 rows=620 width=32) > (actual time=1768.724..1768.725 rows=1 loops=1) > Filter: ('foo@bar.com'::text ~* address_regex) > Rows Removed by Filter: 97781 > Heap Fetches: 0 > Buffers: shared hit=530 > The file in FreeBSD came by pg_dump from the linux system, I am puzzled > why this huge difference in Buffers: shared hit. The "rows removed" value is also quite a bit different, so it's not just a matter of buffer touches --- there's evidently some real difference in how much of the index is being scanned. I speculate that you are using different collations on the two systems, and FreeBSD's collation happens to place the first matching row earlier in the index. regards, tom lane