Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iB2VX-00045k-CH for pgsql-performance@arkaria.postgresql.org; Thu, 19 Sep 2019 19:54:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iB2VW-0002Wf-1j for pgsql-performance@arkaria.postgresql.org; Thu, 19 Sep 2019 19:54:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iB2VV-0002WX-OP for pgsql-performance@lists.postgresql.org; Thu, 19 Sep 2019 19:54:25 +0000 Received: from hm1831-n-113.locaweb.com.br ([189.126.112.113]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iB2VR-0004UN-Qx for pgsql-performance@lists.postgresql.org; Thu, 19 Sep 2019 19:54:25 +0000 Received: from mcbain0014.correio.biz (189.126.112.17) by hm1831-n-113.locaweb.com.br id hgfee015cto3 for ; Thu, 19 Sep 2019 16:54:02 -0300 (envelope-from ) Received: from proxy.email-ssl.com.br (bartf0031.email.locaweb.com.br [10.31.120.63]) by mcbain0014.correio.biz (Postfix) with ESMTP id 5FAB23803A5; Thu, 19 Sep 2019 16:54:00 -0300 (-03) x-locaweb-id: qyHzKK_R8aWhjwoIerpCUhsi5PfCUymhK53qXIAegdcRogeYX3-XTadcSpgGGxitWQf3rKGbFuqvLmn5XdJ_XeDnSC7FYZn7HbLXpGF-9IgCFmgQGgrxCDEo15F9LB44OnsLfXjEQNdayh8qp-s9AotEt2KUQ2RJBl9oRDY6_jQGONTy23UbTLyu956pUuVT8UlUgaIM6XARSVi84RGoZ3y_BYb-aN8PXpaI7MRvykI= NmM3NTY5NzM3MjZmNjI2NTcyNzQ2ZjQwNzM2OTczNjM2ZjYyNzI2MTJlNjM2ZjZkMmU2Mjcy x-locaweb-id: qyHzKK_R8aWhjwoIerpCUhsi5PfCUymhK53qXIAegdcRogeYX3-XTadcSpgGGxitWQf3rKGbFuqvLmn5XdJ_XeDnSC7FYZn7HbLXpGF-9IgCFmgQGgrxCDEo15F9LB44OnsLfXjEQNdayh8qp-s9AotEt2KUQ2RJBl9oRDY6_jQGONTy23UbTLyu956pUuVT8UlUgaIM6XARSVi84RGoZ3y_BYb-aN8PXpaI7MRvykI= NmM3NTY5NzM3MjZmNjI2NTcyNzQ2ZjQwNzM2OTczNjM2ZjYyNzI2MTJlNjM2ZjZkMmU2Mjcy X-LocaWeb-COR: locaweb_2009_x-mail X-AuthUser: luisroberto@siscobra.com.br Received: from [192.168.0.42] (unknown [189.45.198.123]) (Authenticated sender: luisroberto@siscobra.com.br) by proxy.email-ssl.com.br (Postfix) with ESMTPSA id 39B6AB0110D; Thu, 19 Sep 2019 16:54:13 -0300 (-03) Cc: pgsql-performance@lists.postgresql.org Subject: Re: Slow query on a one-tuple table To: Michael Lewis References: <24571.1568910502@sss.pgh.pa.us> <774d6080-d6d7-e9e7-7351-9a412c7d5956@siscobra.com.br> From: =?UTF-8?Q?Lu=c3=ads_Roberto_Weck?= Message-ID: Date: Thu, 19 Sep 2019 16:59:01 -0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: pt-BR List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Em 19/09/2019 15:34, Igor Neyman escreveu: > -----Original Message----- > From: Luís Roberto Weck [mailto:luisroberto@siscobra.com.br] > Sent: Thursday, September 19, 2019 2:30 PM > To: Michael Lewis > Cc: pgsql-performance@lists.postgresql.org > Subject: Re: Slow query on a one-tuple table > > WARNING: This email originated from outside of Perceptron! Please be mindful of PHISHING and MALWARE risks. > > Em 19/09/2019 14:21, Michael Lewis escreveu: >> Is this result able to be repeated? > Yes, I can consistently repeat it. > > Postgres version is 11.1. > > Other executions: > > Index Scan using assessoria_pkey on public.assessoria (cost=0.25..2.47 > rows=1 width=62) (actual time=1.591..4.035 rows=1 loops=1) > Output: asscod, asscambol > Index Cond: (assessoria.asscod = 1) > Buffers: shared hit=1187 > Planning Time: 0.053 ms > Execution Time: 4.055 ms > > Index Scan using assessoria_pkey on public.assessoria (cost=0.25..2.47 > rows=1 width=62) (actual time=1.369..3.838 rows=1 loops=1) > Output: asscod, asscambol > Index Cond: (assessoria.asscod = 1) > Buffers: shared hit=1187 > Planning Time: 0.033 ms > Execution Time: 3.851 ms > > ________________________________________________________________________________________________________________ > > But can you repeat it with "LIMIT 1"? > Notice huge difference in "buffers hit" while doing (the same) Index Scan in two plans. > > Regards, > Igor Neyman With LIMIT 1, I get 3 shared buffers hit, pretty much always.