Re: Slow query - Mailing list pgsql-performance

From Tom Lane
Subject Re: Slow query
Date
Msg-id 20749.1048543730@sss.pgh.pa.us
Whole thread Raw
In response to Re: Slow query  (Oleg Lebedev <oleg.lebedev@waterford.org>)
List pgsql-performance
Oleg Lebedev <oleg.lebedev@waterford.org> writes:
> I just ran the query you sent me and attached the output of EXPLAIN
> ANALYZE as TOMs_plan.txt
> It did not speed up the query significantly.

Nope.  I was hoping to see a faster-start plan, but given the number of
rows involved I guess it won't change its mind.  You're going to have to
think about a more intelligent approach, rather than minor tweaks.

One question: since objectid is evidently a primary key, why are you
doing a subselect for the first part?  Wouldn't it give the same result
just to say "m.activity = '347667'" in the top-level WHERE?

As for the second part, I think you'll have to try to rewrite it as a
join with the media table.

            regards, tom lane


pgsql-performance by date:

Previous
From: Oleg Lebedev
Date:
Subject: Re: Slow query
Next
From: Oleg Lebedev
Date:
Subject: Re: Slow query