Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs
Date: 2017-11-21 10:25:47
Message-ID: CAKoxK+46xO9mWH-f8P1ZDTFXjn0noUfDrfiD60rZwuJ_pc7KkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Nov 20, 2017 at 4:38 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> 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 ...

Of course I was meaning MCVs and MCFs, it did not make sense to use
the histogram here!
Thanks for the query, it works (tested on 9.6.6).

Luca

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2017-11-21 11:04:30 Re: unsubscribe
Previous Message Magnus Hagander 2017-11-21 09:36:11 Re: unsubscribe