public inbox for [email protected]  
help / color / mirror / Atom feed
From: Erik Brandsberg <[email protected]>
To: Shaozhong SHI <[email protected]>
Cc: pgsql-sql <[email protected]>
Subject: Re: How to do things like \timing on in a do loop?
Date: Sat, 15 Oct 2022 16:04:41 -0400
Message-ID: <CAFcck8HXvU7XXReM2FA9gMWxehKvw=y92TD0wOiU7Gk5QkXw_Q@mail.gmail.com> (raw)
In-Reply-To: <CA+i5JwbMGFD_Yu93oHgqvq3zmftRp4OsLjkyRUKob4oQDkDe_w@mail.gmail.com>
References: <CA+i5JwbMGFD_Yu93oHgqvq3zmftRp4OsLjkyRUKob4oQDkDe_w@mail.gmail.com>

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 <[email protected]> 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
>


view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: How to do things like \timing on in a do loop?
  In-Reply-To: <CAFcck8HXvU7XXReM2FA9gMWxehKvw=y92TD0wOiU7Gk5QkXw_Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox