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 1q6A5S-0008HP-C0 for pgsql-novice@arkaria.postgresql.org; Mon, 05 Jun 2023 13:17:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q6A5P-0000xv-Th for pgsql-novice@arkaria.postgresql.org; Mon, 05 Jun 2023 13:17:27 +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 1q6A5P-0000xm-JS for pgsql-novice@lists.postgresql.org; Mon, 05 Jun 2023 13:17:27 +0000 Received: from sender11-op-o11.zoho.eu ([31.186.226.225]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q6A5J-000LYa-V8 for pgsql-novice@lists.postgresql.org; Mon, 05 Jun 2023 13:17:25 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1685971038; cv=none; d=zohomail.eu; s=zohoarc; b=CC/89EPr011eaRXV61bPB9IAdT97cbYVhCzRh/pfhbHXzb6SaFCVdfByM1KeYwwPujfwNebW2b1sCg0JZMLTO71NzorDcQxAeakEhl5iu4WpIswP8QUqoPOMY1Pv5GHyt5c6FH/GTwoOFudpG0cBvFG0dQk6k6DZgHmxh99FN6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1685971038; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=T2QAd0aBiB1DLMNJFcoYZ8rrxpI5WWA5EEBpOhKXkV8=; b=NLI8E8I4FlVGR59R190Kb7Fu16c9lbrJsOvVe9FNASLYL5tkYABDao2aACfc1602Ic+ATaQkH/8XG1ngWuT0lXPyKi3ge3YdOanBpK9OeLC0NrJEmLWk9Skh0Gmllx0VObwl1kYcvWQDM7LPPRG9liG4OamMBcVhYtibe4fbhkM= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=trallnag.com; spf=pass smtp.mailfrom=tim@trallnag.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1685971038; s=zmail; d=trallnag.com; i=tim@trallnag.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=T2QAd0aBiB1DLMNJFcoYZ8rrxpI5WWA5EEBpOhKXkV8=; b=kom6KEJ2bjYVdVpT5Opxm8c22eDNZEOJZDzribm8AYZvPF1B75tHY3D+S9fJa2EQ 8Nf3g7D0Z0L81yx0+asaFOrIo9RPb2bq9jmwmnHrXrniICKdZ5uu+yDiSOiaZjqRfoi pUksQCel/IXF7plBWx600sbHs9DQYRVNC2LkJG+I= Received: from mail.zoho.eu by mx.zoho.eu with SMTP id 168597103756788.65403997293151; Mon, 5 Jun 2023 15:17:17 +0200 (CEST) Date: Mon, 05 Jun 2023 15:17:17 +0200 From: Tim Schwenke To: "David G. Johnston" Cc: "Pgsql Novice" Message-ID: <1888bb46d75.c27dbb7f688001.5044215935079224344@trallnag.com> In-Reply-To: References: <1888b7bb7fa.112313046679561.2788161417267896332@trallnag.com> Subject: Re: Does PostgreSQL cache all columns of a table after SELECT? MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello David, from what I understand, in PostgreSQL, tables are stored in one or more fil= es called segments. There is no separation by columns. https://www.postgresql.org/docs/8.1/storage.html This means if I select a single column from a table the first time, the ful= l file / segment is read and put into page cache if there is enough space. = This means a table with only one large column large_a takes up less page ca= che compared to a table with many large columns large_a and large_b, even t= hough in both cases only large_a is selected. Is that more or less correct? Ignoring toast? Tim S. ---- On Mon, 05 Jun 2023 14:58:21 +0200 David G. Johnston wrote --- >=20 >=20 > On Monday, June 5, 2023, Tim Schwenke tim@trallnag.com> wrote: >=20 >=20 > Does the cache also contain large_b? Or is only large_a cached? Assumpti= on is that memory is large enough to fit everything. >=20 >=20 > Shared buffers is a page cache. >=20 > David J.=C2=A0 >=20