[OSM-dev] [OSM-talk] osm2pgsql hstore (was: Wind turbines no longer rendered on mapnik layer)
jukka.rahkonen at latuviitta.fi
Fri Feb 17 08:36:25 GMT 2012
Jochen Topf wrote:
> On Fri, Feb 17, 2012 at 07:44:41AM +0000, Jukka Rahkonen wrote:
>> Frederik Ramm <frederik <at> remote.org> writes:
>> > Hi,
>> > On 02/16/2012 07:25 PM, Graham Jones wrote:
>> > > This reminded me of a question I have been meaning to ask for quite
>> > > while - is a database generated by osm2pgsql with an hstore expected
>> > > perform similarly to one without?
>> > I never ran one with hstore when I think of what this must mean for
>> > database engine, and storage space, then I shudder and would not be
>> > surprised by the factor 5 you mentioned.
>> How about doing it with relations? Let the importer program create four
>> These tables would each have two attributes: Geometry and osm_is.
>> Geometries in
>> the osm_relation would be of type "geometry collection", that is, a
>> of whatever, and it could hold for example the tranport route relation
>> with the
>> route and bus stops and everything in one PostGIS geometry object.
>> Then there should be one or four tables for tags (everything in one
>> table or
>> split to suit the geometry tables). The three attributes would be
>> osm_id, key,
>> and value. Osm_id would be used as a foreing key for joining geometries
>> attributes. If osm_id can not be guaranteed to be unique then there
>> should be
>> point_id, line_id, polygon_id and relation_id added to suitable places.
>> Every attribute would be indexed. For Mapnik use where all that is
>> needed is to
>> do simple SQL selects. I guess that this database would be faster to
>> query than
>> hstore even it also contains all the tags. It might be faster for Mapnik
>> the current tables with extra wide attribute schema because now
>> attributes are
>> not indexed at all (or are they?). SQL queries according to tags and
>> values or
>> even with a part of the tag and value strings would be easier to do than
>> hstore. People could enhance attributes for some special uses by
>> max_speeds and other values which are actually measures from strings to
>> or doubles etc.
>> This option is so obvious that I believe that someone must have tried it
>> already. It would be nice to hear about experiences.
> Much too slow. Requiring joins on every query is not a good idea. And
> the right indexes is important. You can't just index everything and hope
> would do the right thing. (The most important index btw is the geometry
> not the attribute indexes, although having the right attribute indexes
> or there can help.)
Sorry, havin spatial index is so obvious that it did not even comen into
my mind to mention it. Do you have cold numbers about speed differences or
suggestions for good SQL queries to test with if I will get interested
enough to do a test some day? With this database structure I do not
foresee big difficulties with indexing, and joins with foreing keys is
vastly used in relational databases so perhaps it is not necessarily so
> Jochen Topf jochen at remote.org http://www.remote.org/jochen/
More information about the dev