Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egG9t-0005Ay-D2 for pgsql-general@arkaria.postgresql.org; Mon, 29 Jan 2018 20:36:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egG9r-000696-Uu for pgsql-general@arkaria.postgresql.org; Mon, 29 Jan 2018 20:36:03 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egG9r-00068w-Ms for pgsql-general@lists.postgresql.org; Mon, 29 Jan 2018 20:36:03 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egG9l-000496-T8 for pgsql-general@postgresql.org; Mon, 29 Jan 2018 20:36:02 +0000 Received: by mail-wm0-x244.google.com with SMTP id v71so36266963wmv.2 for ; Mon, 29 Jan 2018 12:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=G/TfNsuse/zATsiknrDGcAs2kMedYvCZDmDgDHnUPN8=; b=NnmZDwEKROnzn5TD4y2KP41WXZOE6OReFNaC88ZXmlgE2QSKo5VGwcVStekaRpYmAr 7Pf6NNA93GhCTC78dSzQ5SkRzmum94InLSgpvkKagy/sTnvaER9EnIzGc1eBdFjNpMRj K+sI/pShbmlAbJf5QljWFAtVtqSBG5r4WwsljEUkFQzTrPhsNvgzIUqzH47EO7Dw/J2d cwWckQCdoggrrARtxrhULNr09qeTFJjLRTefUDxcNyXBiIBVXU8TqzqoJ7MTrcIkoRrb ME9TxHs6uZL8N3rliMYt4P6R4QZpYCkaUUVw29hNfVInjg4n6O6WWS2+ni77QaEDuqIA 37hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=G/TfNsuse/zATsiknrDGcAs2kMedYvCZDmDgDHnUPN8=; b=hnWpXdn5/hm9+l+IAJiNGG91tt1+75fmPiGCEd3nBFp6NcwJ1aw2kfNXbJPbh7W2Ys jjgNcgGtB5gi8LvqGyY+I2IV0UGTkzEyCd5P6FzJMvQndhgOiXhnfxj5URoMHst4wIHX x1TW8O2VDez498eEw43ZTAPGmp7f6U2HkGndl1FJVPW5ocJr4tMM0pPY9RbK9n1/iDeE Ypmd9CQ4kzGr7+NS+yJd2Bduro+QUDCtK5j4fvoRLJszxwb09EuAnJEjU0n2QElfWttX 8AHgBHof+QthA3fgPxPb/Jv27qTx8mBPa7M2cYR5ov5Tl5QTbIOx02IRcLJfJQslYUXe JWDQ== X-Gm-Message-State: AKwxyteK8s+ooU/bCy2yBWzcqXlZUeQV9ASthIbZk8ofxrfrY7PnPrDa 9vzr4xeTJTJMVSvJRoTU4gliEWkqjibyxX7AJEjvUXK55agAaYAXIu2EXMrSCcBhc6ydH51ibXB BFXcPZZ9LcNNkKNnKWJiuz9AxyMjzH3gVZ6UBbJkrRDe1ObLAMfs+4+3vZRdUnR2Ecfo99fO6kC 0EzvM4JREB X-Google-Smtp-Source: AH8x226sayfAlpAGtnvH55tLCyY0JRd7vwTDAbKanTS+Ad96YtowJ5D0DRc0knmVuCm8LRHc2ly1NA== X-Received: by 10.28.155.66 with SMTP id d63mr17189365wme.132.1517258153046; Mon, 29 Jan 2018 12:35:53 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id 63sm15636889wms.46.2018.01.29.12.35.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jan 2018 12:35:52 -0800 (PST) Subject: Re: EXPLAIN BUFFERS: dirtied To: Vitaliy Garnashevich , Tom Lane Cc: pgsql-general@postgresql.org References: <21a14f5f-b39c-3aa8-da2c-2112ee328b93@gmail.com> <6040.1517251115@sss.pgh.pa.us> From: Tomas Vondra Message-ID: Date: Mon, 29 Jan 2018 21:35:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01/29/2018 08:21 PM, Vitaliy Garnashevich wrote: > I've read this article: https://wiki.postgresql.org/wiki/Hint_Bits > > It says: > >> A plain SELECT, count(*), or VACUUM on the entire table will check >> every tuple for visibility and set its hint bits. > > Suppose, a new page was created using many INSERTs, and then was written > to disk during a checkpoint. There were no SELECTs or VACUUM on the page > or table yet. Will the following SELECT of one tuple from the page > update hint bits for ALL tuples on the page? Is that correct? > Possibly, if there are no old transactions running. > When a page is initially created and then is being written to disk > during a checkpoint, does checkpoint writer update the hint bits before > writing the page, or the following SELECT/VACUUM will have to do that > (possibly loading/updating/writing the page again)? > Checkpoint only deals with 8kB chunks of data. Hint bits are not set on a page, but on individual items (rows), so it's not up to the checkpoint process to tweak that - that's up to queries accessing the data. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services