Обсуждение: Improve query speed?

Поиск
Список
Период
Сортировка

Improve query speed?

От
James David Smith
Дата:
Hi there,

I was wondering if anyone had any ideas on how to make this UPDATE
query any quicker please?

UPDATE stage_cleaned
SET route_geom =
(SELECT route_geom.wkb_geometry FROM route_geom WHERE
route_geom.stage_cleaned_id::text = stage_cleaned.id::text GROUP BY
stage_cleaned_id, wkb_geometry)
WHERE route_geom IS NULL;

The table 'stage_cleaned' has about 300,000 rows, and the table
route_geom has a similar number.

Thanks

James


Re: Improve query speed?

От
Luca Ferrari
Дата:
On Tue, Aug 27, 2013 at 12:26 PM, James David Smith
<james.david.smith@gmail.com> wrote:
> Hi there,
>
> I was wondering if anyone had any ideas on how to make this UPDATE
> query any quicker please?
>
> UPDATE stage_cleaned
> SET route_geom =
> (SELECT route_geom.wkb_geometry FROM route_geom WHERE
> route_geom.stage_cleaned_id::text = stage_cleaned.id::text GROUP BY
> stage_cleaned_id, wkb_geometry)
> WHERE route_geom IS NULL;

Well, hard to say if you do not provide information about what you
mean with "quicker" and about how the inner select is executed. I
would recommend running the inner join query alone and see how the
planner is going to extract the data from it.

Luca