From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs
Date: Mon, 20 Nov 2017 10:38:18 -0500
Message-ID: <9874.1511192298@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKoxK+6BN7BSVKg-aZdFmEMutP+QbyuwN4pftS89ohB-zHTyRw@mail.gmail.com>
References: <CAKoxK+4d8cssGCTjsbLQNxCMaSND2FYvx92X3_moT_rPrfL65g@mail.gmail.com>
<20171117204150.GD25796@telsasoft.com>
<CAKoxK+6BN7BSVKg-aZdFmEMutP+QbyuwN4pftS89ohB-zHTyRw@mail.gmail.com>
Luca Ferrari <fluca1978@infinito.it> writes:
> I don't think it is what I'm looking for, I would like something ,like:
> select unnest( histogram_bounds::text::text[] ), unnest(
> most_common_freqs ) from pg_stats
> but with correlation between the two array indexes. Is it something
> achievable in SQL? Or should I use a plpgsql loop with an index?
Those two aren't correlated ... but I think what you want is
select ...,v,f
from
pg_stats,
rows from (unnest(most_common_vals::text::text[]),
unnest(most_common_freqs)) r(v,f)
where ...
Seems to work back to 9.4.
regards, tom lane
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: tgl@sss.pgh.pa.us, fluca1978@infinito.it, pryzby@telsasoft.com
Subject: Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs
In-Reply-To: <9874.1511192298@sss.pgh.pa.us>
References: <CAKoxK+4d8cssGCTjsbLQNxCMaSND2FYvx92X3_moT_rPrfL65g@mail.gmail.com> <20171117204150.GD25796@telsasoft.com> <CAKoxK+6BN7BSVKg-aZdFmEMutP+QbyuwN4pftS89ohB-zHTyRw@mail.gmail.com> <9874.1511192298@sss.pgh.pa.us>
* 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