| From: | Claudio Freire <klaussfreire(at)gmail(dot)com> |
|---|---|
| To: | Ioannis Anagnostopoulos <ioannis(at)anatec(dot)com> |
| Cc: | pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: A very long running query.... |
| Date: | 2012-07-21 20:10:51 |
| Message-ID: | CAGTBQpY6Ma44cvGmbcsjc_BBcScec1KOv7kd2_VRU1Ss9OM3RQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice pgsql-performance |
On Fri, Jul 20, 2012 at 6:19 PM, Ioannis Anagnostopoulos
<ioannis(at)anatec(dot)com> wrote:
> (feed_all_y2012m07.ship_pos_messages join
> ais_server.ship_objects on (ship_pos_messages.obj_id = ship_objects.obj_id))
> on (message_copies.msg_id = ship_pos_messages.msg_id)
It's this part of the query that's taking 3.2 hours.
Move the filtered message_copies to a CTE, and the filtered
ship_pos_messages join to another CTE. That should (in my experience)
get you better performance.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Claudio Freire | 2012-07-21 20:11:27 | Re: A very long running query.... |
| Previous Message | Ioannis Anagnostopoulos | 2012-07-21 19:24:24 | Re: A very long running query.... |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Claudio Freire | 2012-07-21 20:11:27 | Re: A very long running query.... |
| Previous Message | Ioannis Anagnostopoulos | 2012-07-21 19:24:24 | Re: A very long running query.... |