Re: BUG #14302: SQL with LIMIT degrades performance seriously

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Kaijiang Chen <chenkaijiang(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14302: SQL with LIMIT degrades performance seriously
Date: 2016-08-31 13:58:58
Message-ID: CA+bJJbx3o_tPQpzbkYqzgMhi0jL53OF0YfpB6iszNOpfd8FhAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christoph Berg 2016-08-31 15:37:37 Re: BUG #14294: Problem in generate series between dates
Previous Message Francisco Olarte 2016-08-31 13:55:30 Re: BUG #14302: SQL with LIMIT degrades performance seriously