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 1tk8c7-000Sv1-VJ for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2025 21:25:15 +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 1tk8c6-003LEx-6v for pgsql-general@arkaria.postgresql.org; Mon, 17 Feb 2025 21:25:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tk8c5-003LEp-Ry for pgsql-general@lists.postgresql.org; Mon, 17 Feb 2025 21:25:13 +0000 Received: from smtp.burggraben.net ([88.198.69.140]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tk8c1-001QXK-21 for pgsql-general@postgresql.org; Mon, 17 Feb 2025 21:25:11 +0000 Received: from elch.exwg.net (elch.exwg.net [IPv6:2001:470:7120:1:21b:21ff:fef0:248b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "elch.exwg.net", Issuer "R11" (verified OK)) by smtp.burggraben.net (Postfix) with ESMTPS id B9406C0030F; Mon, 17 Feb 2025 22:25:08 +0100 (CET) Received: by elch.exwg.net (Postfix, from userid 1000) id 94B43FE581; Mon, 17 Feb 2025 22:25:08 +0100 (CET) Date: Mon, 17 Feb 2025 22:25:08 +0100 From: Christoph Moench-Tegeder To: Ron Johnson Cc: pgsql-general Subject: Re: Loading the latest N rows into the cache seems way too fast. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.13 (2024-03-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ## Ron Johnson (ronljohnsonjr@gmail.com): > Loading 200K rows is more than 200MB. I expected this "prewarm" statement > to take much longer than 1/2 second. Am I still in the dark ages of > computer speed, or is this statement not doing what I hope it's doing? > > $ time psql -h foo bar -Xc "DO \$\$ BEGIN PERFORM * FROM mytbl ORDER BY id > DESC LIMIT 200000 ; END \$\$;" You can check what that statement does - e.g. in pg_stat_statements, or (on an idle database, so the effects aren't lost in the noise) in pg_stat_database or pg_statio_user_tables. Between what the storage components of the last decade (e.g. those SATA SSDs which are already being replaced in the market by NVME) can deliver (>400MB/s, often marketed as ">500 MB/s" but on SATA that's optimistic) and the fact that there are most likely some blocks in the database' buffer and/or the OS buffer, the observed throughput is not neccessarily unrealistic. With modern "server" hardware, getting throughput in the "gigabytes per second" range is considered normal and expected. Regards, Christoph -- Spare Space