Re: Bad query plan with high-cardinality column

From: Alexander Staubo <alex(at)bengler(dot)no>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Bad query plan with high-cardinality column
Date: 2013-02-22 21:34:21
Message-ID: D0D7098559DD470B9C2DE753E74B83E4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Friday, February 22, 2013 at 21:47 , Kevin Grittner wrote:
> I suspect you would be better off without those two indexes, and
> instead having an index on (conversation_id, created_at). Not just
> for the query you show, but in general.

Indeed, that solved it, thanks!

> In my experience these problems come largely from the planner not
> knowing the cost of dealing with each tuple. I see a lot less of
> this if I raise cpu_tuple_cost to something in the 0.03 to 0.05
> range.

Is this something I can just frob a bit without worrying about it adversely impacting database performance across the board, or should I be very careful and do lots of testing on a staging box first?

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2013-02-22 22:17:54 Re: Bad query plan with high-cardinality column
Previous Message Alexander Staubo 2013-02-22 21:31:48 Re: Bad query plan with high-cardinality column