Re: Sub-query too slow

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sub-query too slow
Date: 2004-04-01 00:14:20
Message-ID: 20040401001420.GA23073@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 31, 2004 at 05:41:03PM -0500, Randall Skelton wrote:
> Can someone please explain how I can make this sub-query faster? In
> the case below, 'test' is a temporary table but I have tried with test
> being a full, indexed, and 'vacuum analysed' table and it still takes
> more than 130 seconds. Note that 'test' has very few rows but
> 'cal_quat_1' has many rows.

Have you tried just using a join? Like:

explain analyze select value from cal_quat_1, test where timestamp = t
order by t;

Also, an index on cal_quat_1.timestamp might be good too...
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> This space intentionally left blank

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randall Skelton 2004-04-01 00:58:15 Re: Sub-query too slow
Previous Message Trilobite Trilobite 2004-04-01 00:11:18 SQL trees and other nonsense...