Re: best way to query - Mailing list pgsql-general

From Tom Lane
Subject Re: best way to query
Date
Msg-id 1857.1201280712@sss.pgh.pa.us
Whole thread Raw
In response to Re: best way to query  (Steve Clark <sclark@netwolves.com>)
Responses Re: best way to query  (Steve Clark <sclark@netwolves.com>)
List pgsql-general
Steve Clark <sclark@netwolves.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

pgsql-general by date:

Previous
From: "Luis Alberto Pérez Paz"
Date:
Subject: Re: Postgresql + digital signature
Next
From: Steve Clark
Date:
Subject: Re: best way to query