Re:

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2024-01-25 20:24:32
Message-ID: CANzqJaCaDnmdFXqmkadnB55ux42Ac9vybRLL3mP+4L1_q6TnXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 25, 2024 at 12:29 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> > EXPLAIN SELECT works inside a FOR loop, but only the first line of the
> > EXPLAIN output is stored. What's the magic sauce for seeing the whole
> > EXPLAIN output?
>
> The usual way is to run a FOR loop over the lines of output.
> Quick & dirty example:
>
> regression=# do $$
> declare ln text;
> begin
> for ln in explain select * from int8_tbl join int4_tbl on q1=f1 loop
> raise notice '%', ln;
> end loop;
> end $$;
> NOTICE: Hash Join (cost=1.11..2.23 rows=5 width=20)
> NOTICE: Hash Cond: (int8_tbl.q1 = int4_tbl.f1)
> NOTICE: -> Seq Scan on int8_tbl (cost=0.00..1.05 rows=5 width=16)
> NOTICE: -> Hash (cost=1.05..1.05 rows=5 width=4)
> NOTICE: -> Seq Scan on int4_tbl (cost=0.00..1.05 rows=5 width=4)
> DO
>
>
Thanks.

In response to

  • Re: at 2024-01-25 17:29:43 from Tom Lane

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2024-01-25 20:32:25 Re: permission denied on socket
Previous Message Atul Kumar 2024-01-25 20:22:58 permission denied on socket