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 1iAzeD-0005VV-NO for pgsql-performance@arkaria.postgresql.org; Thu, 19 Sep 2019 16:51:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAzeC-0006eo-Kk for pgsql-performance@arkaria.postgresql.org; Thu, 19 Sep 2019 16:51:12 +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 1iAzeC-0006eM-BQ for pgsql-performance@lists.postgresql.org; Thu, 19 Sep 2019 16:51:12 +0000 Received: from hm1831-n-121.locaweb.com.br ([189.126.112.121]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iAze6-0002sq-Qx for pgsql-performance@lists.postgresql.org; Thu, 19 Sep 2019 16:51:10 +0000 Received: from mcbain0016.correio.biz (201.76.49.39) by hm1831-n-113.locaweb.com.br id hgeouq15ctou for ; Thu, 19 Sep 2019 13:50:46 -0300 (envelope-from ) Received: from proxy.email-ssl.com.br (bartf0031.email.locaweb.com.br [10.31.120.63]) by mcbain0016.correio.biz (Postfix) with ESMTP id D5910AA0343 for ; Thu, 19 Sep 2019 13:50:56 -0300 (-03) 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 9A9B8B012D5 for ; Thu, 19 Sep 2019 13:50:58 -0300 (-03) Subject: Slow query on a one-tuple table To: pgsql-performance@lists.postgresql.org References: <24571.1568910502@sss.pgh.pa.us> From: =?UTF-8?Q?Lu=c3=ads_Roberto_Weck?= Message-ID: <774d6080-d6d7-e9e7-7351-9a412c7d5956@siscobra.com.br> Date: Thu, 19 Sep 2019 13:55:46 -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: <24571.1568910502@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------C79B9342E780E9287C0EC587" Content-Language: pt-BR List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------C79B9342E780E9287C0EC587 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi! I have a query that SELECT's only one tuple using a PK (https://explain.depesz.com/s/Hskt) the field I am selecting are a bigint and a text. Why does it read 1095 shared buffers read? If I adda LIMIT 1 clause, the query runs much faster: https://explain.depesz.com/s/bSZn This table has only one tuple anyway, so I can't understand why does it takes so long without the LIMIT 1. --------------C79B9342E780E9287C0EC587 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Hi!

I have a query that SELECT's only one tuple using a PK (https://explain.depesz.com/s/Hskt)

the field I am selecting are a bigint and a text. Why does it read 1095 shared buffers read?

If I adda LIMIT 1 clause, the query runs much faster: https://explain.depesz.com/s/bSZn

This table has only one tuple anyway, so I can't understand why does it takes so long without the LIMIT 1.
--------------C79B9342E780E9287C0EC587--