[postgis-users] Mapserv Issues

David Blasby dblasby at refractions.net
Mon May 17 09:58:11 PDT 2004


Zamil Murji wrote:
> Ok, after doing some more research,  I have found my bottleneck.  Inside mappostgis.c there is a function called msPOSTGISLayerGetItems. This function formats a query:
> sprintf(sql,"SELECT * FROM %s LIMIT 0",table_name); // attempt the query, but dont actually do much (this might take sometime if there is an order by!)


I thought this might cause a slowdown (hence the comment).

Try changing the line to:

sprintf(sql,"SELECT * FROM (%s) WHERE false LIMIT 0",table_name);
or
sprintf(sql,"SELECT * FROM %s WHERE false LIMIT 0",table_name);


The SQL parser should notice that this will not return any rows and just 
return the schema.

dave



More information about the postgis-users mailing list