Skip site navigation (1) Skip section navigation (2)

Re: Costly "Sort Key" on indexed timestamp column

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ogjunk-pgjedan(at)yahoo(dot)com
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Costly "Sort Key" on indexed timestamp column
Date: 2004-09-10 04:17:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
<ogjunk-pgjedan(at)yahoo(dot)com> writes:
> I'm tuning my PostgreSQL DB (7.3.4) and have come across a query that
> doesn't use an index I created specially for it, and consequently takes
> circa 2 seconds to run. :(
> ...
> The output of EXPLAIN ANALYZE follows.  Note how 99% of the total cost
> comes from "Sort Key: userinfo1_.create_date".

No, you are misreading the output.  99% of the cost comes from the join

I think the problem is that you have forced a not-very-appropriate join
order by use of INNER JOIN syntax, and so the plan is creating
intermediate join outputs that are larger than they need be.  See

7.4 is a bit more forgiving about this; compare

			regards, tom lane

In response to

pgsql-performance by date

Next:From: Greg StarkDate: 2004-09-10 06:34:28
Subject: Re: Multiple Uniques
Previous:From: Tom LaneDate: 2004-09-10 03:07:11
Subject: Re: Multiple Uniques

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group