From: hubert depesz lubaczewski <depesz@depesz.com>
To: Ian Dauncey <Ian.Dauncey@bankzero.co.za>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Postgres query
Date: Fri, 11 Mar 2022 11:57:02 +0100
Message-ID: <20220311105702.GA24666@depesz.com> (raw)
In-Reply-To: <DBAPR08MB56872F9A7E2437CE08968BFFC00C9@DBAPR08MB5687.eurprd08.prod.outlook.com>
References: <DBAPR08MB56872F9A7E2437CE08968BFFC00C9@DBAPR08MB5687.eurprd08.prod.outlook.com>
On Fri, Mar 11, 2022 at 10:02:39AM +0000, Ian Dauncey wrote:
> Can anyone assist in shedding some light here.
> We getting this query popping up in our postgresql log file at the same time as the connections to the databases starts increasing.
> Not sure what is initiating this query, but we get around a hundred per second until we restart our applications.
> Any help will be appreciated.
> "select $1[s], s - pg_catalog.array_lower($1,1) + 1
> from pg_catalog.generate_series(pg_catalog.array_lower($1,1),
> pg_catalog.array_upper($1,1),1) as g(s)"
The query simply unpacks given array.
For example, assuming array $1 is '{5,10,15}' it will yield:
?column? │ ?column?
──────────┼──────────
5 │ 1
10 │ 2
15 │ 3
(3 rows)
basically old way to achieve unpacking of array, these days normally it would be called like:
$ select * from unnest('{5,10,15}'::int4[]) with ordinality;
unnest │ ordinality
────────┼────────────
5 │ 1
10 │ 2
15 │ 3
(3 rows)
What is running it it's hard to say, the query doesn't strike me as
something that any db driver would call on its own.
depesz
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: depesz@depesz.com, Ian.Dauncey@bankzero.co.za
Subject: Re: Postgres query
In-Reply-To: <20220311105702.GA24666@depesz.com>
References: <DBAPR08MB56872F9A7E2437CE08968BFFC00C9@DBAPR08MB5687.eurprd08.prod.outlook.com> <20220311105702.GA24666@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox