Re: statistics target for columns in unique constraint?

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: ach <alanchines(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: statistics target for columns in unique constraint?
Date: 2013-05-13 22:10:06
Message-ID: CABRT9RBwmDxjq-tzLMh6rFX-suJYVQMiGSQAADsueg07rvB1dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, May 13, 2013 at 6:01 PM, ach <alanchines(at)gmail(dot)com> wrote:
> what I'm wondering is, since
> the unique constraint already covers the whole table and all rows in
> entirety, is it really necessary for statistics to be set that high on
> those?

AFAIK if there are exact-matching unique constraints/indexes for a
query's WHERE clause, the planner will deduce that the query only
returns 1 row and won't consult statistics at all.

> Or does that only serve to slow down inserts to that table?

It doesn't slow down inserts directly. Tables are analyzed in the
background by autovacuum. However, I/O traffic from autovacuum analyze
may slow down inserts running concurrently.

Regards,
Marti

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mike McCann 2013-05-13 22:36:03 Re: Hardware suggestions for maximum read performance
Previous Message Tom Lane 2013-05-13 20:33:19 Re: RT3.4 query needed a lot more tuning with 9.2 than it did with 8.1