Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs - Mailing list pgsql-general

From Luca Ferrari
Subject Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs
Date
Msg-id CAKoxK+46xO9mWH-f8P1ZDTFXjn0noUfDrfiD60rZwuJ_pc7KkA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] unnest-like pg_stats.most_common_values and pg_stats.most_common_freqs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, Nov 20, 2017 at 4:38 PM, Tom Lane <tgl@sss.pgh.pa.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


pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: unsubscribe
Next
From: Stephen Frost
Date:
Subject: Re: unsubscribe