CityofSantaMonica / mds-provider

Python tools for working with MDS Provider data
https://github.com/openmobilityfoundation/mobility-data-specification
MIT License
18 stars 20 forks source link

Using the jsonb column type #41

Closed thekaveman closed 5 years ago

thekaveman commented 6 years ago

This corresponds with changes in CityofSantaMonica/mds-provider-services#12

hunterowens commented 5 years ago

@thekaveman effects on implementation? / Migration path?

thekaveman commented 5 years ago

Migration should be straight-forward, see https://github.com/CityofSantaMonica/mds-provider-services/blob/db/db/migrate/0.2.0.sql.

Everything I've been reading says there are only very limited use-cases for using a json column type (e.g. if you absolutely need to preserve whitespace or key order for some reason). jsonb is more performant, it is indexable, and has some interesting query capabilities not available in json. The Postgres JSON Types doc has a pretty good write-up.

There could be a slight performance hit on writing new data, as there is some work done to format text into jsonb.

hunterowens commented 5 years ago

Thanks. I have to make corresponding changes into aqueduct for migrations, not super hard but good to have reference implementation.