[Mapserver-users] Optimising PostGIS relates/subselects/views

David Blasby dblasby at refractions.net
Mon Feb 3 19:41:19 EST 2003


>         DATA "the_geom FROM
>                         (SELECT mylayer.oid AS oid,
>                                 mylayer.the_geom AS the_geom,
>                                 mytable.value AS value
>                         FROM mylayer, mytable
>                         WHERE mylayer.lut=mytable.lut)
>                         AS mylayer
>                         USING oid
>                         USING srid=-1"
>
>         CLASSITEM "value"

Ensure you have an index on mylayer.lut and mytable.lut:

CREATE INDEX mytable_lut_idx ON mytable (lut);
CREATE INDEX mylayer_lut_idx ON mylayer (lut);

You might want to change "...AS mylayer..." to "..AS foo..." so you're not
equivocating "mylayer".

If this doesnt speed things up, you'll have to use the new
index-selectivity support in the CVS version of PostGIS.  See the postgis
mailing list for more details.

dave




More information about the mapserver-users mailing list