[Tile-serving] [openstreetmap/osm2pgsql] Store slim table tags in hstore (#692)
Peter
notifications at github.com
Sat Oct 27 12:47:28 UTC 2018
Hi, I am using direct [`jsonb_object(text[])`](https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSON-CREATION-TABLE) to convert tags of slim tables, was fine. For geometry tables also easy, alter table `USING hstore_to_jsonb_loose(tags)` [as commented here](https://github.com/openstreetmap/osm2pgsql/issues/533#issuecomment-271745550) (instead `::jsonb` default cast)... And it is not only "to being more efficient", is also to being more standard.
About other (above) comments, nowdays — 2018 and [pg v9.3 end of life](https://www.postgresql.org/support/versioning/), the v9.4+ is the reference version — is time to use `jsonb` datatype... Even when equivalent (as @Komzpa say "Internally jsonb and hstore are similar"), `jsonb` is better. It is important an `osm2pgsql` **option to user decision**.
The `jsonb` datatype (a JSON-standard) is a [*de facto* standard](https://en.wikipedia.org/wiki/De_facto_standard) for PostgreSQL developer community:
> *if you're choosing a dynamic structure you should choose jsonb over hstore*, <br/>[dba.stackexchange](https://dba.stackexchange.com/questions/115825/jsonb-with-indexing-vs-hstore) C. Ringer (2015)
> [jsonb-vs-hstore **performance**](http://mateuszmarchel.com/blog/2016/06/29/jsonb-vs-hstore-performance-battle/): `hstore` have equal performance only *"especially if it's indexed with GIN"*, M. Marchel (2016)... But default `osm2pgsql` is without indexation, so `hstore` have low performance.
> *In most cases JSONB is likely what you want when looking for a NoSQL, schema-less, datatype* (...) <br/>(...) *JSONB - In most cases*; <br/> *hstore - Can work fine for text based key-value looks, but in general JSONB can still work great here*, [citusdata.com](https://www.citusdata.com/blog/2016/07/14/choosing-nosql-hstore-json-jsonb/) C. Kerstiens (2016).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/692#issuecomment-433617469
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20181027/8070222c/attachment.html>
More information about the Tile-serving
mailing list