Re: best way to query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Clark <sclark(at)netwolves(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: best way to query
Date: 2008-01-25 17:05:12
Message-ID: 1857.1201280712@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Clark <sclark(at)netwolves(dot)com> writes:
> Tom Lane wrote:
>> Also, whatever is the ORDER BY for?

> without the order by it wants to do a seq scan of t_unit_event_log.
> see below:
> explain select count(*) from t_event_ack_log where event_log_no not
> in (select event_log_no from t_unit_event_log);
> QUERY PLAN
> ----------------------------------------------------------------------------------------
> Aggregate (cost=12144872193.82..12144872193.82 rows=1 width=0)
> -> Seq Scan on t_event_ack_log (cost=0.00..12144871485.07
> rows=283497 width=0)
> Filter: (NOT (subplan))
> SubPlan
> -> Seq Scan on t_unit_event_log (cost=0.00..40286.56
> rows=1021156 width=4)
> (5 rows)

Hmm, the big problem with that isn't the seqscan but the lack of a
Materialize step to buffer it; which says to me that you're running a
pretty old Postgres version (8.0 or older). You should think about an
update if you're running into performance issues.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Clark 2008-01-25 17:15:43 Re: best way to query
Previous Message Luis Alberto Pérez Paz 2008-01-25 16:57:18 Re: Postgresql + digital signature