Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know what will be the performance difference between publishing a spatial table directly vs. creating a view of the same table and publishing it in GeoServer?

Does the spatial index on a table still work on a view derived from it?

Thanks a lot!

share|improve this question
if you turn debuging on you should see the query in the log, then run explain on it in psql – iant Jun 3 '13 at 7:52
up vote 3 down vote accepted

Views are just named queries stored into the database so they will use indexes on the underlying tables just as if you had run the query statement.

Depending on your postgres expertise it might be worthwhile reading the INDEX section of the postgres manual, expecially the part on expressions.

You can confirm that the view and the query are assigned the same execution plan by creating the view and then using the EXPLAIN command on the view and the query. The output should be identical.

share|improve this answer

In Oracle there is something called materialized view. This might be available in some next version of Postgre, but for now you can try a workaround.

If your data does not need to be updated frequently you can create a table that you fill in from results of a view query, and then refresh it periodically by scheduled job.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.