Re: Slow query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow query
Date: 2003-03-24 22:08:50
Message-ID: 20749.1048543730@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Oleg Lebedev 2003-03-24 22:37:10 Re: Slow query
Previous Message Oleg Lebedev 2003-03-24 21:46:09 Re: Slow query