Search Postgresql Archives

Re: Postgres query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux