Re: Loading the latest N rows into the cache seems way too fast. - Mailing list pgsql-general

From Christoph Moench-Tegeder
Subject Re: Loading the latest N rows into the cache seems way too fast.
Date
Msg-id Z7OpNGOpf3Ad1OOI@elch.exwg.net
Whole thread Raw
In response to Loading the latest N rows into the cache seems way too fast.  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
## 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



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Loading the latest N rows into the cache seems way too fast.
Next
From: Tom Lane
Date:
Subject: Re: Loading the latest N rows into the cache seems way too fast.