Re: How to do things like \timing on in a do loop?

From: Erik Brandsberg <erik(at)heimdalldata(dot)com>
To: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: How to do things like \timing on in a do loop?
Date: 2022-10-15 20:04:41
Message-ID: CAFcck8HXvU7XXReM2FA9gMWxehKvw=y92TD0wOiU7Gk5QkXw_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You can't, as \timing is not a postgres command. It is a psql command, so
is not interpreted by the server itself.

On Sat, Oct 15, 2022, 3:33 PM Shaozhong SHI <shishaozhong(at)gmail(dot)com> wrote:

> DO
> $do$
> declare
>
> j int=1;
>
> BEGIN
>
> for j in 1..100 loop
>
> \timing on
>
> select * from a_table;
>
> end loop;
>
> end
> $$;
>
>
> It appears that \timing on is not allowed in a do statement.
>
> Any alternative to do that in a do statement?
>
> Regards,
>
> David
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message hubert depesz lubaczewski 2022-10-16 09:21:35 Re: How to do things like \timing on in a do loop?
Previous Message Shaozhong SHI 2022-10-15 19:32:59 How to do things like \timing on in a do loop?