At my project, I alrealdy have tables wich have columns with json(nested) data, but they're not JSON data type. For some json attributes, I have a column at the same table, so that I can have some performance while searching, ordering, etc.. Just to use like relational data. For better understanding, here is an example of what I actually have:
lb_reg_marcacao_especial
Column | Type | Modifiers
----------------------+-----------------------------+-----------
id | integer | not null
json | character varying | not null
nm_marcacao | character varying |
dt_inclusao | timestamp without time zone |
Indexes:
"lb_reg_marcacao_especial_pkey" PRIMARY KEY, btree (id_reg)
"lb_reg_marcacao_especial_nm_marcacao_key" UNIQUE CONSTRAINT, btree (nm_marcacao)
while json columns will have data like:
'{
"dt_inclusao": "02/12/2013 11:05:27",
"nm_user_inclusao": "Some name",
"nested": {
"nm_marcacao": "marc1",
"dt_ultima_alteracao": ""
},
"nm_user_ultima_alteracao": "",
"ds_marcacao": "marc1",
"st_marcacao": true
}'
Some of these json data have ~100 keys and about 3 level of nesting. As you can see, data is replicated, since I have some keys in json and in table's columns (nm_marcacao and dt_inclusao).
So, I'm thinking about changing the json column data type to JSON and removing the other columns. What about you ?