Re: BUG #14302: SQL with LIMIT degrades performance seriously - Mailing list pgsql-bugs

From Francisco Olarte
Subject Re: BUG #14302: SQL with LIMIT degrades performance seriously
Date
Msg-id CA+bJJbx3o_tPQpzbkYqzgMhi0jL53OF0YfpB6iszNOpfd8FhAA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14302: SQL with LIMIT degrades performance seriously  (Kaijiang Chen <chenkaijiang@gmail.com>)
List pgsql-bugs
Top posting makes the flow difficult to follow, editing a little bit.

>> Why not just create the correct index on each partition?
>> (parent_id,user_id)

On Wed, Aug 31, 2016 at 2:42 PM, Kaijiang Chen <chenkaijiang@gmail.com> wrote:
> It couldn't solve the problem.
> I've already created 2 btree indexes, one for parent_id, the other for
> user_id.

A (parent_id, user_id) index can be used instead of the one for
parent_id, so it will nbot need to much extra, and can solve some
queries. The planner can normally detected where some keys can be
solved directly with a composite index.


> Do you mean to create an multi-column index on (parent_id, user_id)? --
> still couldn't solve the problem, since we still need index for user_id (for
> other sql) and planner will turn to user_id index.

How do you know it will turn to the bad index?

Francisco Olarte.

pgsql-bugs by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: BUG #14302: SQL with LIMIT degrades performance seriously
Next
From: Christoph Berg
Date:
Subject: Re: BUG #14294: Problem in generate series between dates