Re: Statistics collection question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
Cc: "Postgres General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Statistics collection question
Date: 2007-09-03 14:00:12
Message-ID: 8091.1188828012@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com> writes:
> A couple of questions about the "most_common_vals" stuff in pg_stats
> for a high traffic table:

> 1. Can I tell the stats collector to collect only values of a column
> where a certain regex is matched?

Not directly, but you could set up a partial index defined that way,
and ANALYZE would collect stats on the index contents. Whether the
planner could actually do anything with the information is another
story; I suspect you're wasting your time with this idea.

> 2. Secondly, for a unique column in the table, will the
> "most_common_vals" always be -1? I guess this could make sense, but I
> was wondering if the stats collector could somehow collect at least
> 1000 unique values to improve at least some performance.

most_common_vals will (and should) be empty if there aren't actually any
common values, but aren't you getting a histogram? Exactly what
performance do you think will be improved?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-09-03 15:04:12 Re: WAL Archiving problem
Previous Message Norberto Delle 2007-09-03 13:40:36 Re: WAL Archiving problem