Re: Join the master table with other table is very slow (partitioning)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ao Jianwang <aojw2008(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Join the master table with other table is very slow (partitioning)
Date: 2013-03-15 15:42:14
Message-ID: 6303.1363362134@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Ao Jianwang <aojw2008(at)gmail(dot)com> writes:
> I found if we join the master table with other small table, then the
> running time is slow. While, if we join each child table with the small
> table, then it's very fast. Any comments and suggestions are greatly
> appreciated.

https://wiki.postgresql.org/wiki/Slow_Query_Questions

You haven't shown us table schemas, particularly the index definitions.
It looks to me like the partition child tables probably don't have
indexes that are well adapted to this query. Equality constraints
should be on leading columns of the index, but the only index I see
evidence of in your plans has the date column first. Probably the
planner is considering an inner-indexscan plan and rejecting it as
being more expensive than this one, because it would have to scan too
much of the index.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ao Jianwang 2013-03-15 16:04:08 Re: Join the master table with other table is very slow (partitioning)
Previous Message Ao Jianwang 2013-03-15 15:39:54 Re: Join the master table with other table is very slow (partitioning)