Re: Small table selection extremely slow!

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Bo Guo <bo(dot)guo(at)gisticinc(dot)com>
Cc: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Small table selection extremely slow!
Date: 2024-05-14 11:16:05
Message-ID: CAApHDvriMd3RpH9khEV_p+tgqOexRvS7HT1isfdv1OjMA0wSBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 14 May 2024 at 23:12, Bo Guo <bo(dot)guo(at)gisticinc(dot)com> wrote:
> The following query took 20 seconds on a small table of 108 rows with a dozen columns:
>
> SELECT * FROM azgiv.layers;
>
> EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM azgiv.layers;
> Seq Scan on layers (cost=0.00..14.00 rows=200 width=233) (actual time=0.010..0.087 rows=200 loops=1)
> Buffers: shared hit=12
> Planning:
> Buffers: shared hit=51
> Planning Time: 0.233 ms
> Execution Time: 0.121 ms

One difference between the SELECT and EXPLAIN ANALYZE is that SELECT
will detoast your toasted datums whereas EXPLAIN ANALYZE will not.

It's likely the slowness comes from the detoasting.

David

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message MichaelDBA 2024-05-14 11:26:40 Re: Small table selection extremely slow!
Previous Message Bo Guo 2024-05-14 11:11:56 Small table selection extremely slow!