On Mon, Nov 20, 2017 at 4:38 PM, Tom Lane <tgl@xxxxxxxxxxxxx> 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