Comparison of JSON and User-Defined types in Postgres 9.3

json, performance, postgresql, types, user-defined

Solution

- I think JSON is much more flexible than User-defined types, you can add whatever optional attributes you want, you can nest them, you can put them into lists;

- JSON is very readable format;

- JSON is standard object notation in many languages (Javascript, Python) so you can read data from table and use it;

- You don't have to create new type anytime when you want to process data, you can create JSON, process it, then just forget about it;

Problem

I wonder why there is so much fuss about JSON support in Postgres 9.3. What are advantages of JSON over User-defined types (UDTs)? What are pitfalls in using UDTs? Is access to tables with UDTs inefficient? Is ALTER TYPE ADD attribute slow? How are UDTs physically stored by Postgres? Please, explain and give links to additional information.

Original source