limit in PostgreSQL

Jean-Denis Giguere jdenisgiguere at FASTMAIL.FM
Fri Aug 12 00:00:47 EDT 2005


Stephen Woodbridge wrote:
> Jason FU wrote:
> 
>> In Oracle, we have rowid for limiting the number of selected 
>> rows/records.
>> In PostgreSQL, we have limit and offset. But how do we use limit in the
>> MapServer. For Oracle spatial, we simply add rowid in the FILTER 
>> statement.
>> What do we do in PostGIS connection?
> 
> 
> DATA "the_geom from (SELECT gid, the_geom, ... FROM mytable LIMIT 2000) 
> as foo using srid=4326 using unique gid"
> 
> so basically you can put any SQL query as a sub-select as long as you 
> return at least the_geom and gid or oid, other fields can be used for 
> class expressions.
> 
> -Steve W
>  http://imaptools.com/


Is there a trick to use the spatial index automatically generated by MS 
inside the sub-select query ? This could be useful when you want to use 
complex request on a small part of a large database.

Regards,

Jean-Denis



More information about the mapserver-users mailing list