I'm currently trying to pull neighborhood data from Zillow's Neighborhood page (http://www.zillow.com/howto/api/neighborhood-boundaries.htm) and then load it onto a leaflet map, openstreetmap. I created a "Neighborhood" table and added the data into PostGIS using shp2pgsql. Everything works great, I can query the data and get back GeoJSON using ST_AsGeoJSON, however the query is really slow. I'm considering how I could speed up this process as it looks like ST_AsGeoJSON is the primary culprit. This table will not be updated that often, so I'm wondering if it would make sense to simply store the GeoJSON in another column within Neighborhood and then return that instead of converting the geom column every page refresh.
Here's an example of my Neighborhood table.
CREATE TABLE "neighborhood" (gid serial, "state" varchar(2), "county" varchar(43), "city" varchar(64), "name" varchar(64), "regionid" numeric); ALTER TABLE "neighborhood" ADD PRIMARY KEY (gid); SELECT AddGeometryColumn('','neighborhood','geom','0','MULTIPOLYGON',2);